comparison src/regexp_nfa.c @ 15265:a7d02a56b5d5 v8.1.0641

patch 8.1.0641: no check for out-of-memory when converting regexp commit https://github.com/vim/vim/commit/c57463c9c6ee893285f553e0ac3b2fe5935f16b8 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Dec 26 22:04:41 2018 +0100 patch 8.1.0641: no check for out-of-memory when converting regexp Problem: No check for out-of-memory when converting regexp. Solution: Bail out when lalloc() returns NULL. (John Marriott)
author Bram Moolenaar <Bram@vim.org>
date Wed, 26 Dec 2018 22:15:05 +0100
parents ffd834f893aa
children 55ccc2d353bd
comparison
equal deleted inserted replaced
15264:ac8b7be7e2fa 15265:a7d02a56b5d5
3216 return NULL; \ 3216 return NULL; \
3217 } 3217 }
3218 3218
3219 if (nfa_calc_size == FALSE) 3219 if (nfa_calc_size == FALSE)
3220 { 3220 {
3221 /* Allocate space for the stack. Max states on the stack : nstate */ 3221 // Allocate space for the stack. Max states on the stack: "nstate'.
3222 stack = (Frag_T *)lalloc((nstate + 1) * sizeof(Frag_T), TRUE); 3222 stack = (Frag_T *)lalloc((nstate + 1) * sizeof(Frag_T), TRUE);
3223 if (stack == NULL)
3224 return NULL;
3223 stackp = stack; 3225 stackp = stack;
3224 stack_end = stack + (nstate + 1); 3226 stack_end = stack + (nstate + 1);
3225 } 3227 }
3226 3228
3227 for (p = postfix; p < end; ++p) 3229 for (p = postfix; p < end; ++p)