https://bugs.webkit.org/show_bug.cgi?id=178890
Reviewed by Keith Miller.
JSTests:
New regression test.
* stress/regress-178890.js: Added.
Source/JavaScriptCore:
We need to let a contained subpattern backtrack before declaring that the containing
parenthesis doesn't match. If the subpattern fails to match backtracking, then we
can check to see if we trying to backtrack below the minimum match count.
* yarr/YarrInterpreter.cpp:
(JSC::Yarr::Interpreter::backtrackParentheses):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224072
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2017-10-26 Michael Saboff <msaboff@apple.com>
+
+ REGRESSION(r222601): We fail to properly backtrack into a sub pattern of a parenthesis with non-zero minimum
+ https://bugs.webkit.org/show_bug.cgi?id=178890
+
+ Reviewed by Keith Miller.
+
+ New regression test.
+
+ * stress/regress-178890.js: Added.
+
2017-10-26 Mark Lam <mark.lam@apple.com>
JSRopeString::RopeBuilder::append() should check for overflows.
--- /dev/null
+// Regression test for bug 178890
+
+if (!/:(?:\w)+\(([']?)((?:\([^\)]+\)|[^\(\)]*){1,2})\1\)/.test(":not('.hs-processed')"))
+ throw "/:(?:\w)+\(([']?)((?:\([^\)]+\)|[^\(\)]*){1,2})\1\)/.test(\":not('.hs-processed')\") should succeed, but actually fails";
+2017-10-26 Michael Saboff <msaboff@apple.com>
+
+ REGRESSION(r222601): We fail to properly backtrack into a sub pattern of a parenthesis with non-zero minimum
+ https://bugs.webkit.org/show_bug.cgi?id=178890
+
+ Reviewed by Keith Miller.
+
+ We need to let a contained subpattern backtrack before declaring that the containing
+ parenthesis doesn't match. If the subpattern fails to match backtracking, then we
+ can check to see if we trying to backtrack below the minimum match count.
+
+ * yarr/YarrInterpreter.cpp:
+ (JSC::Yarr::Interpreter::backtrackParentheses):
+
2017-10-26 Mark Lam <mark.lam@apple.com>
JSRopeString::RopeBuilder::append() should check for overflows.
}
case QuantifierGreedy: {
- if (backTrack->matchAmount == term.atom.quantityMinCount)
+ if (!backTrack->matchAmount)
return JSRegExpNoMatch;
ParenthesesDisjunctionContext* context = backTrack->lastContext;
popParenthesesDisjunctionContext(backTrack);
freeParenthesesDisjunctionContext(context);
- if (result != JSRegExpNoMatch)
+ if (result != JSRegExpNoMatch || backTrack->matchAmount < term.atom.quantityMinCount)
return result;
}