updated for version 7.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.
diff --git a/src/regexp.c b/src/regexp.c
index d36ac49..bae547c 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -8081,7 +8081,8 @@
* 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 @@
#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)