Skip to content

Commit adcdbb6

Browse files
committed
updated for version 7.4.051
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.
1 parent 3c85f00 commit adcdbb6

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/regexp_nfa.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6458,6 +6458,7 @@ nfa_regmatch(prog, start, submatch, m)
64586458
if (add_state != NULL)
64596459
{
64606460
nfa_pim_T *pim;
6461+
nfa_pim_T pim_copy;
64616462

64626463
if (t->pim.result == NFA_PIM_UNUSED)
64636464
pim = NULL;
@@ -6531,6 +6532,15 @@ nfa_regmatch(prog, start, submatch, m)
65316532
pim = NULL;
65326533
}
65336534

6535+
/* If "pim" points into l->t it will become invalid when
6536+
* adding the state causes the list to be reallocated. Make a
6537+
* local copy to avoid that. */
6538+
if (pim == &t->pim)
6539+
{
6540+
copy_pim(&pim_copy, pim);
6541+
pim = &pim_copy;
6542+
}
6543+
65346544
if (add_here)
65356545
addstate_here(thislist, add_state, &t->subs, pim, &listidx);
65366546
else

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,8 @@ static char *(features[]) =
738738

739739
static int included_patches[] =
740740
{ /* Add new patch number below this line */
741+
/**/
742+
51,
741743
/**/
742744
50,
743745
/**/

0 commit comments

Comments
 (0)