Title: [255584] trunk
Revision
255584
Author
[email protected]
Date
2020-02-03 13:23:20 -0800 (Mon, 03 Feb 2020)

Log Message

\0 identity escapes should be syntax errors in Unicode patterns only
https://bugs.webkit.org/show_bug.cgi?id=207114

Reviewed by Darin Adler.

JSTests:

* test262/expectations.yaml: Mark 2 test cases as passing.

Source/_javascript_Core:

This change adds a separate check for null character because `strchr`
always returns a non-null pointer when called with '\0' as second argument.

Grammar: https://tc39.es/ecma262/#prod-annexB-IdentityEscape
(/u flag precludes the use of SourceCharacterIdentityEscape)

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

Modified Paths

Diff

Modified: trunk/JSTests/ChangeLog (255583 => 255584)


--- trunk/JSTests/ChangeLog	2020-02-03 21:12:43 UTC (rev 255583)
+++ trunk/JSTests/ChangeLog	2020-02-03 21:23:20 UTC (rev 255584)
@@ -1,3 +1,12 @@
+2020-02-03  Alexey Shvayka  <[email protected]>
+
+        \0 identity escapes should be syntax errors in Unicode patterns only
+        https://bugs.webkit.org/show_bug.cgi?id=207114
+
+        Reviewed by Darin Adler.
+
+        * test262/expectations.yaml: Mark 2 test cases as passing.
+
 2020-02-01  Alexey Shvayka  <[email protected]>
 
         Non-alphabetical \c escapes should be syntax errors in Unicode patterns only

Modified: trunk/JSTests/test262/expectations.yaml (255583 => 255584)


--- trunk/JSTests/test262/expectations.yaml	2020-02-03 21:12:43 UTC (rev 255583)
+++ trunk/JSTests/test262/expectations.yaml	2020-02-03 21:23:20 UTC (rev 255584)
@@ -1573,9 +1573,6 @@
 test/built-ins/RegExp/prototype/unicode/cross-realm.js:
   default: 'Test262Error: cross-realm RegExp.prototype Expected a TypeError to be thrown but no exception was thrown at all'
   strict mode: 'Test262Error: cross-realm RegExp.prototype Expected a TypeError to be thrown but no exception was thrown at all'
-test/built-ins/RegExp/unicode_restricted_identity_escape.js:
-  default: "Test262Error: Invalid IdentityEscape in AtomEscape: '\\"
-  strict mode: "Test262Error: Invalid IdentityEscape in AtomEscape: '\\"
 test/built-ins/RegExp/unicode_restricted_identity_escape_alpha.js:
   default: "Test262Error: IdentityEscape in AtomEscape: 'k' Expected a SyntaxError to be thrown but no exception was thrown at all"
   strict mode: "Test262Error: IdentityEscape in AtomEscape: 'k' Expected a SyntaxError to be thrown but no exception was thrown at all"

Modified: trunk/Source/_javascript_Core/ChangeLog (255583 => 255584)


--- trunk/Source/_javascript_Core/ChangeLog	2020-02-03 21:12:43 UTC (rev 255583)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-02-03 21:23:20 UTC (rev 255584)
@@ -1,3 +1,19 @@
+2020-02-03  Alexey Shvayka  <[email protected]>
+
+        \0 identity escapes should be syntax errors in Unicode patterns only
+        https://bugs.webkit.org/show_bug.cgi?id=207114
+
+        Reviewed by Darin Adler.
+
+        This change adds a separate check for null character because `strchr`
+        always returns a non-null pointer when called with '\0' as second argument.
+
+        Grammar: https://tc39.es/ecma262/#prod-annexB-IdentityEscape
+        (/u flag precludes the use of SourceCharacterIdentityEscape)
+
+        * yarr/YarrParser.h:
+        (JSC::Yarr::Parser::isIdentityEscapeAnError):
+
 2020-02-01  Alexey Shvayka  <[email protected]>
 
         Non-alphabetical \c escapes should be syntax errors in Unicode patterns only

Modified: trunk/Source/_javascript_Core/yarr/YarrParser.h (255583 => 255584)


--- trunk/Source/_javascript_Core/yarr/YarrParser.h	2020-02-03 21:12:43 UTC (rev 255583)
+++ trunk/Source/_javascript_Core/yarr/YarrParser.h	2020-02-03 21:23:20 UTC (rev 255584)
@@ -231,7 +231,7 @@
     // For non-unicode patterns, most any character can be escaped.
     bool isIdentityEscapeAnError(int ch)
     {
-        if (m_isUnicode && !strchr("^$\\.*+?()[]{}|/", ch)) {
+        if (m_isUnicode && (!strchr("^$\\.*+?()[]{}|/", ch) || !ch)) {
             m_errorCode = ErrorCode::InvalidIdentityEscape;
             return true;
         }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to