diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-10-06 15:46:11 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-10-06 15:46:11 +0200 |
commit | a951e35478fd78d6d3cd970842502fb76c377df9 (patch) | |
tree | 873423111e193ce680416ed2febbba2a1245d145 /src/regexp_nfa.c | |
parent | b133208080a6dde56e930b5069061f03ea7320ff (diff) | |
download | vim-git-a951e35478fd78d6d3cd970842502fb76c377df9.tar.gz |
updated for version 7.4.051v7.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.
Diffstat (limited to 'src/regexp_nfa.c')
-rw-r--r-- | src/regexp_nfa.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c index 216459c4d..0c6ff0b63 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 |