]> granicus.if.org Git - vim/commitdiff
updated for version 7.4.051 v7.4.051
authorBram Moolenaar <Bram@vim.org>
Sun, 6 Oct 2013 13:46:11 +0000 (15:46 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 6 Oct 2013 13:46:11 +0000 (15:46 +0200)
Problem:    Syntax highlighting a Yaml file causes a crash. (Blake Preston)
Solution:   Copy the pim structure before calling addstate() to avoid it
            becoming invalide when the state list is reallocated.

src/regexp_nfa.c
src/version.c

index 216459c4d0b29389ba7ca3c5d4e9671b44945c09..0c6ff0b6332cec718fc1fbe7936635b56861eaf9 100644 (file)
@@ -6458,6 +6458,7 @@ nfa_regmatch(prog, start, submatch, m)
            if (add_state != NULL)
            {
                nfa_pim_T *pim;
+               nfa_pim_T pim_copy;
 
                if (t->pim.result == NFA_PIM_UNUSED)
                    pim = NULL;
@@ -6531,6 +6532,15 @@ nfa_regmatch(prog, start, submatch, m)
                    pim = NULL;
                }
 
+               /* If "pim" points into l->t it will become invalid when
+                * adding the state causes the list to be reallocated.  Make a
+                * local copy to avoid that. */
+               if (pim == &t->pim)
+               {
+                   copy_pim(&pim_copy, pim);
+                   pim = &pim_copy;
+               }
+
                if (add_here)
                    addstate_here(thislist, add_state, &t->subs, pim, &listidx);
                else
index 664e07dd41a26fc8b20c46de8fcf8358d5a8587e..8b6ff662fc17337a685436f33a0d7eeb2d63a465 100644 (file)
@@ -738,6 +738,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    51,
 /**/
     50,
 /**/