Title: [224072] trunk
Revision
224072
Author
[email protected]
Date
2017-10-26 17:31:50 -0700 (Thu, 26 Oct 2017)

Log Message

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.

JSTests:

New regression test.

* stress/regress-178890.js: Added.

Source/_javascript_Core:

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):

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (224071 => 224072)


--- trunk/JSTests/ChangeLog	2017-10-26 23:59:59 UTC (rev 224071)
+++ trunk/JSTests/ChangeLog	2017-10-27 00:31:50 UTC (rev 224072)
@@ -1,3 +1,14 @@
+2017-10-26  Michael Saboff  <[email protected]>
+
+        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  <[email protected]>
 
         JSRopeString::RopeBuilder::append() should check for overflows.

Added: trunk/JSTests/stress/regress-178890.js (0 => 224072)


--- trunk/JSTests/stress/regress-178890.js	                        (rev 0)
+++ trunk/JSTests/stress/regress-178890.js	2017-10-27 00:31:50 UTC (rev 224072)
@@ -0,0 +1,4 @@
+// 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";

Modified: trunk/Source/_javascript_Core/ChangeLog (224071 => 224072)


--- trunk/Source/_javascript_Core/ChangeLog	2017-10-26 23:59:59 UTC (rev 224071)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-10-27 00:31:50 UTC (rev 224072)
@@ -1,3 +1,17 @@
+2017-10-26  Michael Saboff  <[email protected]>
+
+        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  <[email protected]>
 
         JSRopeString::RopeBuilder::append() should check for overflows.

Modified: trunk/Source/_javascript_Core/yarr/YarrInterpreter.cpp (224071 => 224072)


--- trunk/Source/_javascript_Core/yarr/YarrInterpreter.cpp	2017-10-26 23:59:59 UTC (rev 224071)
+++ trunk/Source/_javascript_Core/yarr/YarrInterpreter.cpp	2017-10-27 00:31:50 UTC (rev 224072)
@@ -1110,7 +1110,7 @@
         }
 
         case QuantifierGreedy: {
-            if (backTrack->matchAmount == term.atom.quantityMinCount)
+            if (!backTrack->matchAmount)
                 return JSRegExpNoMatch;
 
             ParenthesesDisjunctionContext* context = backTrack->lastContext;
@@ -1136,7 +1136,7 @@
                 popParenthesesDisjunctionContext(backTrack);
                 freeParenthesesDisjunctionContext(context);
 
-                if (result != JSRegExpNoMatch)
+                if (result != JSRegExpNoMatch || backTrack->matchAmount < term.atom.quantityMinCount)
                     return result;
             }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to