summaryrefslogtreecommitdiff
path: root/src/regexp_nfa.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-02-10 18:18:17 +0100
committerBram Moolenaar <Bram@vim.org>2015-02-10 18:18:17 +0100
commita1d2c58985584116d20fa5e132137d8ff1a535f7 (patch)
tree17c9ade77be20eb64b92acff60b735c03857caaf /src/regexp_nfa.c
parent168e04966c48b0d7d4726934ed2c39a9a0fec2af (diff)
downloadvim-git-a1d2c58985584116d20fa5e132137d8ff1a535f7.tar.gz
updated for version 7.4.623v7.4.623
Problem: Crash with pattern: \(\)\{80000} (Dominique Pelle) Solution: When the max limit is large fall back to the old engine.
Diffstat (limited to 'src/regexp_nfa.c')
-rw-r--r--src/regexp_nfa.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
index 77c787056..224535109 100644
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -2034,9 +2034,10 @@ nfa_regpiece()
}
/* The engine is very inefficient (uses too many states) when the
- * maximum is much larger than the minimum. Bail out if we can
- * use the other engine. */
- if ((nfa_re_flags & RE_AUTO) && maxval > minval + 200)
+ * maximum is much larger than the minimum and when the maximum is
+ * large. Bail out if we can use the other engine. */
+ if ((nfa_re_flags & RE_AUTO)
+ && (maxval > minval + 200 || maxval > 500))
return FAIL;
/* Ignore previous call to nfa_regatom() */
@@ -4254,7 +4255,6 @@ state_in_list(l, state, subs)
* Add "state" and possibly what follows to state list ".".
* Returns "subs_arg", possibly copied into temp_subs.
*/
-
static regsubs_T *
addstate(l, state, subs_arg, pim, off)
nfa_list_T *l; /* runtime state list */
@@ -4392,6 +4392,7 @@ skip_add:
subs = &temp_subs;
}
+ /* TODO: check for vim_realloc() returning NULL. */
l->t = vim_realloc(l->t, newlen * sizeof(nfa_thread_T));
l->len = newlen;
}