summaryrefslogtreecommitdiff
path: root/src/regexp_nfa.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-12-26 22:04:41 +0100
committerBram Moolenaar <Bram@vim.org>2018-12-26 22:04:41 +0100
commitc57463c9c6ee893285f553e0ac3b2fe5935f16b8 (patch)
tree584fac2011aa7d30fb2e564126d431e3c8bb4ce5 /src/regexp_nfa.c
parent548e5985734e4b216852205879daf9bfb00dbe5a (diff)
downloadvim-git-c57463c9c6ee893285f553e0ac3b2fe5935f16b8.tar.gz
patch 8.1.0641: no check for out-of-memory when converting regexpv8.1.0641
Problem: No check for out-of-memory when converting regexp. Solution: Bail out when lalloc() returns NULL. (John Marriott)
Diffstat (limited to 'src/regexp_nfa.c')
-rw-r--r--src/regexp_nfa.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
index ff6215e73..d779feead 100644
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -3218,8 +3218,10 @@ post2nfa(int *postfix, int *end, int nfa_calc_size)
if (nfa_calc_size == FALSE)
{
- /* Allocate space for the stack. Max states on the stack : nstate */
+ // Allocate space for the stack. Max states on the stack: "nstate'.
stack = (Frag_T *)lalloc((nstate + 1) * sizeof(Frag_T), TRUE);
+ if (stack == NULL)
+ return NULL;
stackp = stack;
stack_end = stack + (nstate + 1);
}