]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.1.0641: no check for out-of-memory when converting regexp v8.1.0641
authorBram Moolenaar <Bram@vim.org>
Wed, 26 Dec 2018 21:04:41 +0000 (22:04 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 26 Dec 2018 21:04:41 +0000 (22:04 +0100)
Problem:    No check for out-of-memory when converting regexp.
Solution:   Bail out when lalloc() returns NULL. (John Marriott)

src/regexp_nfa.c
src/version.c

index ff6215e73bc3755a665f9ca29adedeb431e88599..d779feead766aeecb3129ca78dcdf0dc839ba998 100644 (file)
@@ -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);
     }
index 10ba489e55eaee9515eb867219a13310ee0cd82b..3150da92f50faf1bee372d7793abf6dedfc7f9cf 100644 (file)
@@ -799,6 +799,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    641,
 /**/
     640,
 /**/