summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/regexp_nfa.c10
-rw-r--r--src/version.c2
2 files changed, 12 insertions, 0 deletions
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
index 216459c4..0c6ff0b6 100644
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -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
diff --git a/src/version.c b/src/version.c
index 664e07dd..8b6ff662 100644
--- a/src/version.c
+++ b/src/version.c
@@ -739,6 +739,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 51,
+/**/
50,
/**/
49,