Title: [222586] trunk
Revision
222586
Author
mark....@apple.com
Date
2017-09-27 16:58:33 -0700 (Wed, 27 Sep 2017)

Log Message

Yarr::Parser::tryConsumeGroupName() should check for the end of the pattern.
https://bugs.webkit.org/show_bug.cgi?id=177423
<rdar://problem/34621320>

Reviewed by Keith Miller.

JSTests:

* stress/regress-177423.js: Added.

Source/_javascript_Core:

* yarr/YarrParser.h:
(JSC::Yarr::Parser::tryConsumeGroupName):

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (222585 => 222586)


--- trunk/JSTests/ChangeLog	2017-09-27 23:54:41 UTC (rev 222585)
+++ trunk/JSTests/ChangeLog	2017-09-27 23:58:33 UTC (rev 222586)
@@ -1,3 +1,13 @@
+2017-09-27  Mark Lam  <mark....@apple.com>
+
+        Yarr::Parser::tryConsumeGroupName() should check for the end of the pattern.
+        https://bugs.webkit.org/show_bug.cgi?id=177423
+        <rdar://problem/34621320>
+
+        Reviewed by Keith Miller.
+
+        * stress/regress-177423.js: Added.
+
 2017-09-27  Yusuke Suzuki  <utatane....@gmail.com>
 
         Add Above/Below comparisons for UInt32 patterns

Added: trunk/JSTests/stress/regress-177423.js (0 => 222586)


--- trunk/JSTests/stress/regress-177423.js	                        (rev 0)
+++ trunk/JSTests/stress/regress-177423.js	2017-09-27 23:58:33 UTC (rev 222586)
@@ -0,0 +1 @@
+/\k</

Modified: trunk/Source/_javascript_Core/ChangeLog (222585 => 222586)


--- trunk/Source/_javascript_Core/ChangeLog	2017-09-27 23:54:41 UTC (rev 222585)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-09-27 23:58:33 UTC (rev 222586)
@@ -1,3 +1,14 @@
+2017-09-27  Mark Lam  <mark....@apple.com>
+
+        Yarr::Parser::tryConsumeGroupName() should check for the end of the pattern.
+        https://bugs.webkit.org/show_bug.cgi?id=177423
+        <rdar://problem/34621320>
+
+        Reviewed by Keith Miller.
+
+        * yarr/YarrParser.h:
+        (JSC::Yarr::Parser::tryConsumeGroupName):
+
 2017-09-27  Yusuke Suzuki  <utatane....@gmail.com>
 
         Unreviewed, fix x86 breaking due to exhausted registers

Modified: trunk/Source/_javascript_Core/yarr/YarrParser.h (222585 => 222586)


--- trunk/Source/_javascript_Core/yarr/YarrParser.h	2017-09-27 23:54:41 UTC (rev 222585)
+++ trunk/Source/_javascript_Core/yarr/YarrParser.h	2017-09-27 23:58:33 UTC (rev 222586)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009, 2014-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2009-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -999,22 +999,19 @@
     std::optional<String> tryConsumeGroupName()
     {
         ParseState state = saveState();
+        StringBuilder identifierBuilder;
 
-        int ch = tryConsumeIdentifierCharacter();
+        while (!atEndOfPattern()) {
+            int ch = tryConsumeIdentifierCharacter();
+            if (ch == '>') {
+                if (identifierBuilder.length())
+                    return std::optional<String>(identifierBuilder.toString());
+                break;
+            }
+            if (!isIdentifierPart(ch))
+                break;
 
-        if (isIdentifierStart(ch)) {
-            StringBuilder identifierBuilder;
-
-            do {
-                identifierBuilder.append(ch);
-                ch = tryConsumeIdentifierCharacter();
-                if (ch == '>') {
-                    return std::optional<String>(identifierBuilder.toString());
-                    break;
-                }
-                if (!isIdentifierPart(ch))
-                    break;
-            } while (!atEndOfPattern());
+            identifierBuilder.append(ch);
         }
 
         restoreState(state);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to