summaryrefslogtreecommitdiffstats
path: root/src/regexp.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-01-27 12:59:55 +0100
committerBram Moolenaar <Bram@vim.org>2015-01-27 12:59:55 +0100
commite0ad365498399c1bd34dd6361b3f7dc38e84e4ca (patch)
tree11736866896c182b2783ed496e35628e66db5d3d /src/regexp.c
parentdf5caa08f62fe67f11e48771f4a5125ebc5a69b3 (diff)
updated for version 7.4.593v7.4.593
Problem: Crash when searching for "x\{0,90000}". (Dominique Pelle) Solution: Bail out from the NFA engine when the max limit is much higher than the min limit.
Diffstat (limited to 'src/regexp.c')
-rw-r--r--src/regexp.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/regexp.c b/src/regexp.c
index d36ac49bb6..bae547cd6a 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -8081,7 +8081,8 @@ vim_regcomp(expr_arg, re_flags)
* First try the NFA engine, unless backtracking was requested.
*/
if (regexp_engine != BACKTRACKING_ENGINE)
- prog = nfa_regengine.regcomp(expr, re_flags);
+ prog = nfa_regengine.regcomp(expr,
+ re_flags + (regexp_engine == AUTOMATIC_ENGINE ? RE_AUTO : 0));
else
prog = bt_regengine.regcomp(expr, re_flags);
@@ -8105,16 +8106,14 @@ vim_regcomp(expr_arg, re_flags)
#endif
/*
* If the NFA engine failed, try the backtracking engine.
- * Disabled for now, both engines fail on the same patterns.
- * Re-enable when regcomp() fails when the pattern would work better
- * with the other engine.
- *
+ * The NFA engine also fails for patterns that it can't handle well
+ * but are still valid patterns, thus a retry should work.
+ */
if (regexp_engine == AUTOMATIC_ENGINE)
{
+ regexp_engine = BACKTRACKING_ENGINE;
prog = bt_regengine.regcomp(expr, re_flags);
- regexp_engine == BACKTRACKING_ENGINE;
}
- */
}
if (prog != NULL)