Title: [221522] releases/WebKitGTK/webkit-2.18
- Revision
- 221522
- Author
- [email protected]
- Date
- 2017-09-02 01:10:58 -0700 (Sat, 02 Sep 2017)
Log Message
Merge r221400 - semicolon is being interpreted as an = in the LiteralParser
https://bugs.webkit.org/show_bug.cgi?id=176114
Reviewed by Oliver Hunt.
JSTests:
* stress/jsonp-literal-parser-semicolon-is-not-assignment.js: Added.
* stress/resources/literal-parser-test-case.js: Added.
Source/_javascript_Core:
When lexing a semicolon in the LiteralParser, we were properly
setting the TokenType on the current token, however, we were
*returning* the wrong TokenType. The lex function both returns
the TokenType and sets it on the current token. Semicolon was
setting the TokenType to semicolon, but returning the TokenType
for '='. This caused programs like `x;123` to be interpreted as
`x=123`.
* runtime/LiteralParser.cpp:
(JSC::LiteralParser<CharType>::Lexer::lex):
(JSC::LiteralParser<CharType>::Lexer::next):
Modified Paths
Added Paths
Diff
Modified: releases/WebKitGTK/webkit-2.18/JSTests/ChangeLog (221521 => 221522)
--- releases/WebKitGTK/webkit-2.18/JSTests/ChangeLog 2017-09-02 08:10:53 UTC (rev 221521)
+++ releases/WebKitGTK/webkit-2.18/JSTests/ChangeLog 2017-09-02 08:10:58 UTC (rev 221522)
@@ -1,3 +1,13 @@
+2017-08-30 Saam Barati <[email protected]>
+
+ semicolon is being interpreted as an = in the LiteralParser
+ https://bugs.webkit.org/show_bug.cgi?id=176114
+
+ Reviewed by Oliver Hunt.
+
+ * stress/jsonp-literal-parser-semicolon-is-not-assignment.js: Added.
+ * stress/resources/literal-parser-test-case.js: Added.
+
2017-08-17 JF Bastien <[email protected]>
WebAssembly: const in unreachable code decoded incorrectly, erroneously rejects binary as invalid
Added: releases/WebKitGTK/webkit-2.18/JSTests/stress/jsonp-literal-parser-semicolon-is-not-assignment.js (0 => 221522)
--- releases/WebKitGTK/webkit-2.18/JSTests/stress/jsonp-literal-parser-semicolon-is-not-assignment.js (rev 0)
+++ releases/WebKitGTK/webkit-2.18/JSTests/stress/jsonp-literal-parser-semicolon-is-not-assignment.js 2017-09-02 08:10:58 UTC (rev 221522)
@@ -0,0 +1,4 @@
+x = undefined;
+load("./resources/literal-parser-test-case.js");
+if (x !== undefined)
+ throw new Error("Bad result");
Added: releases/WebKitGTK/webkit-2.18/JSTests/stress/resources/literal-parser-test-case.js (0 => 221522)
--- releases/WebKitGTK/webkit-2.18/JSTests/stress/resources/literal-parser-test-case.js (rev 0)
+++ releases/WebKitGTK/webkit-2.18/JSTests/stress/resources/literal-parser-test-case.js 2017-09-02 08:10:58 UTC (rev 221522)
@@ -0,0 +1 @@
+x;1234
Modified: releases/WebKitGTK/webkit-2.18/Source/_javascript_Core/ChangeLog (221521 => 221522)
--- releases/WebKitGTK/webkit-2.18/Source/_javascript_Core/ChangeLog 2017-09-02 08:10:53 UTC (rev 221521)
+++ releases/WebKitGTK/webkit-2.18/Source/_javascript_Core/ChangeLog 2017-09-02 08:10:58 UTC (rev 221522)
@@ -1,3 +1,22 @@
+2017-08-30 Saam Barati <[email protected]>
+
+ semicolon is being interpreted as an = in the LiteralParser
+ https://bugs.webkit.org/show_bug.cgi?id=176114
+
+ Reviewed by Oliver Hunt.
+
+ When lexing a semicolon in the LiteralParser, we were properly
+ setting the TokenType on the current token, however, we were
+ *returning* the wrong TokenType. The lex function both returns
+ the TokenType and sets it on the current token. Semicolon was
+ setting the TokenType to semicolon, but returning the TokenType
+ for '='. This caused programs like `x;123` to be interpreted as
+ `x=123`.
+
+ * runtime/LiteralParser.cpp:
+ (JSC::LiteralParser<CharType>::Lexer::lex):
+ (JSC::LiteralParser<CharType>::Lexer::next):
+
2017-08-26 Yusuke Suzuki <[email protected]>
Merge WeakMapData into JSWeakMap and JSWeakSet
Modified: releases/WebKitGTK/webkit-2.18/Source/_javascript_Core/runtime/LiteralParser.cpp (221521 => 221522)
--- releases/WebKitGTK/webkit-2.18/Source/_javascript_Core/runtime/LiteralParser.cpp 2017-09-02 08:10:53 UTC (rev 221521)
+++ releases/WebKitGTK/webkit-2.18/Source/_javascript_Core/runtime/LiteralParser.cpp 2017-09-02 08:10:58 UTC (rev 221522)
@@ -272,7 +272,7 @@
if (*m_ptr == ';') {
token.type = TokSemi;
token.end = ++m_ptr;
- return TokAssign;
+ return TokSemi;
}
if (isASCIIAlpha(*m_ptr) || *m_ptr == '_' || *m_ptr == '$')
return lexIdentifier(token);
@@ -317,11 +317,15 @@
template <typename CharType>
TokenType LiteralParser<CharType>::Lexer::next()
{
+ TokenType result;
if (m_mode == NonStrictJSON)
- return lex<NonStrictJSON>(m_currentToken);
- if (m_mode == JSONP)
- return lex<JSONP>(m_currentToken);
- return lex<StrictJSON>(m_currentToken);
+ result = lex<NonStrictJSON>(m_currentToken);
+ else if (m_mode == JSONP)
+ result = lex<JSONP>(m_currentToken);
+ else
+ result = lex<StrictJSON>(m_currentToken);
+ ASSERT(m_currentToken.type == result);
+ return result;
}
template <>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes