Title: [172380] trunk
- Revision
- 172380
- Author
- [email protected]
- Date
- 2014-08-10 13:07:34 -0700 (Sun, 10 Aug 2014)
Log Message
JSC Lexer is allowing octals 08 and 09 in strict mode functions
https://bugs.webkit.org/show_bug.cgi?id=135704
Patch by Diego Pino Garcia <[email protected]> on 2014-08-10
Reviewed by Oliver Hunt.
Return syntax error ("Decimal integer literals with a leading zero are
forbidden in strict mode") if a number starts with 0 and is followed
by a digit.
* parser/Lexer.cpp:
(JSC::Lexer<T>::lex):
Modified Paths
Diff
Modified: trunk/LayoutTests/js/basic-strict-mode-expected.txt (172379 => 172380)
--- trunk/LayoutTests/js/basic-strict-mode-expected.txt 2014-08-10 10:25:27 UTC (rev 172379)
+++ trunk/LayoutTests/js/basic-strict-mode-expected.txt 2014-08-10 20:07:34 UTC (rev 172380)
@@ -92,8 +92,8 @@
PASS (function(){'use strict'; for(;;)break missingLabel}) threw exception SyntaxError: Cannot use the undeclared label 'missingLabel'..
PASS 'use strict'; for(;;)continue missingLabel threw exception SyntaxError: Cannot use the undeclared label 'missingLabel'..
PASS (function(){'use strict'; for(;;)continue missingLabel}) threw exception SyntaxError: Cannot use the undeclared label 'missingLabel'..
-PASS 'use strict'; 007; threw exception SyntaxError: Octal escapes are forbidden in strict mode.
-PASS (function(){'use strict'; 007;}) threw exception SyntaxError: Octal escapes are forbidden in strict mode.
+PASS 'use strict'; 007; threw exception SyntaxError: Decimal integer literals with a leading zero are forbidden in strict mode.
+PASS (function(){'use strict'; 007;}) threw exception SyntaxError: Decimal integer literals with a leading zero are forbidden in strict mode.
PASS 'use strict'; '\007'; threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS (function(){'use strict'; '\007';}) threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
PASS '\007'; 'use strict'; threw exception SyntaxError: The only valid numeric escape in strict mode is '\0'.
Modified: trunk/LayoutTests/js/parser-syntax-check-expected.txt (172379 => 172380)
--- trunk/LayoutTests/js/parser-syntax-check-expected.txt 2014-08-10 10:25:27 UTC (rev 172379)
+++ trunk/LayoutTests/js/parser-syntax-check-expected.txt 2014-08-10 20:07:34 UTC (rev 172380)
@@ -66,6 +66,23 @@
PASS Invalid: "function f() { 1.l }"
PASS Valid: "1 .l"
PASS Valid: "function f() { 1 .l }"
+Octal numbers
+PASS Valid: "'use strict'; 0"
+PASS Valid: "function f() { 'use strict'; 0 }"
+PASS Valid: "0"
+PASS Valid: "function f() { 0 }"
+PASS Invalid: "'use strict'; 00"
+PASS Invalid: "function f() { 'use strict'; 00 }"
+PASS Valid: "00"
+PASS Valid: "function f() { 00 }"
+PASS Invalid: "'use strict'; 08"
+PASS Invalid: "function f() { 'use strict'; 08 }"
+PASS Valid: "08"
+PASS Valid: "function f() { 08 }"
+PASS Invalid: "'use strict'; 09"
+PASS Invalid: "function f() { 'use strict'; 09 }"
+PASS Valid: "09"
+PASS Valid: "function f() { 09 }"
Binary and conditional operators
PASS Valid: "a + + typeof this" with ReferenceError
PASS Valid: "function f() { a + + typeof this }"
Modified: trunk/LayoutTests/js/script-tests/parser-syntax-check.js (172379 => 172380)
--- trunk/LayoutTests/js/script-tests/parser-syntax-check.js 2014-08-10 10:25:27 UTC (rev 172379)
+++ trunk/LayoutTests/js/script-tests/parser-syntax-check.js 2014-08-10 20:07:34 UTC (rev 172380)
@@ -88,6 +88,17 @@
invalid("1.l");
valid ("1 .l");
+debug ("Octal numbers");
+
+valid ("'use strict'; 0");
+valid ("0");
+invalid("'use strict'; 00");
+valid ("00");
+invalid("'use strict'; 08");
+valid ("08");
+invalid("'use strict'; 09");
+valid ("09");
+
debug ("Binary and conditional operators");
valid ("a + + typeof this");
Modified: trunk/Source/_javascript_Core/ChangeLog (172379 => 172380)
--- trunk/Source/_javascript_Core/ChangeLog 2014-08-10 10:25:27 UTC (rev 172379)
+++ trunk/Source/_javascript_Core/ChangeLog 2014-08-10 20:07:34 UTC (rev 172380)
@@ -1,3 +1,17 @@
+2014-08-10 Diego Pino Garcia <[email protected]>
+
+ JSC Lexer is allowing octals 08 and 09 in strict mode functions
+ https://bugs.webkit.org/show_bug.cgi?id=135704
+
+ Reviewed by Oliver Hunt.
+
+ Return syntax error ("Decimal integer literals with a leading zero are
+ forbidden in strict mode") if a number starts with 0 and is followed
+ by a digit.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer<T>::lex):
+
2014-08-08 Mark Lam <[email protected]>
REGRESSION: Inspector crashes when debugger is paused and injected scripts access window.screen().
Modified: trunk/Source/_javascript_Core/parser/Lexer.cpp (172379 => 172380)
--- trunk/Source/_javascript_Core/parser/Lexer.cpp 2014-08-10 10:25:27 UTC (rev 172379)
+++ trunk/Source/_javascript_Core/parser/Lexer.cpp 2014-08-10 20:07:34 UTC (rev 172380)
@@ -1664,13 +1664,13 @@
}
record8('0');
+ if (strictMode && isASCIIDigit(m_current)) {
+ m_lexErrorMessage = "Decimal integer literals with a leading zero are forbidden in strict mode";
+ token = INVALID_OCTAL_NUMBER_ERRORTOK;
+ goto returnError;
+ }
if (isASCIIOctalDigit(m_current)) {
if (parseOctal(tokenData->doubleValue)) {
- if (strictMode) {
- m_lexErrorMessage = "Octal escapes are forbidden in strict mode";
- token = INVALID_OCTAL_NUMBER_ERRORTOK;
- goto returnError;
- }
token = NUMBER;
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes