]> granicus.if.org Git - vim/commitdiff
patch 8.0.0828: Coverity: may dereference NULL pointer v8.0.0828
authorBram Moolenaar <Bram@vim.org>
Tue, 1 Aug 2017 13:14:26 +0000 (15:14 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 1 Aug 2017 13:14:26 +0000 (15:14 +0200)
Problem:    Coverity: may dereference NULL pointer.
Solution:   Bail out if calloc_state() returns NULL.

src/regexp_nfa.c
src/version.c

index 804d742ab3b63707a2f6e32c53fa8d6c21db578e..40d6605f01402e6a204ca2e1d67c9735baff5171 100644 (file)
@@ -3527,7 +3527,11 @@ post2nfa(int *postfix, int *end, int nfa_calc_size)
            {
                /* NFA_ZEND -> NFA_END_PATTERN -> NFA_SKIP -> what follows. */
                skip = alloc_state(NFA_SKIP, NULL, NULL);
+               if (skip == NULL)
+                   goto theend;
                zend = alloc_state(NFA_ZEND, s1, NULL);
+               if (zend == NULL)
+                   goto theend;
                s1->out= skip;
                patch(e.out, zend);
                PUSH(frag(s, list1(&skip->out)));
index 732e8a52693576bef11daa7ad87e976ad0686f4c..e7b9feed98672733c071af9d55b40ae9dac6373c 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    828,
 /**/
     827,
 /**/