Title: [202648] trunk
- Revision
- 202648
- Author
- [email protected]
- Date
- 2016-06-29 14:48:17 -0700 (Wed, 29 Jun 2016)
Log Message
Destructuring variable declaration is missing a validation of the syntax of a sub production when there is a rhs
https://bugs.webkit.org/show_bug.cgi?id=159267
Reviewed by Mark Lam.
Source/_javascript_Core:
We were parsing something without checking if it had a syntax error.
This is wrong for many reasons, but it could actually cause a crash
in a debug build if you parsed particular programs.
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseVariableDeclarationList):
LayoutTests:
* js/parser-syntax-check-expected.txt:
* js/script-tests/parser-syntax-check.js:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (202647 => 202648)
--- trunk/LayoutTests/ChangeLog 2016-06-29 21:23:29 UTC (rev 202647)
+++ trunk/LayoutTests/ChangeLog 2016-06-29 21:48:17 UTC (rev 202648)
@@ -1,3 +1,13 @@
+2016-06-29 Saam barati <[email protected]>
+
+ Destructuring variable declaration is missing a validation of the syntax of a sub production when there is a rhs
+ https://bugs.webkit.org/show_bug.cgi?id=159267
+
+ Reviewed by Mark Lam.
+
+ * js/parser-syntax-check-expected.txt:
+ * js/script-tests/parser-syntax-check.js:
+
2016-06-29 Nan Wang <[email protected]>
AX: Crash in WebCore::Document::focusNavigationStartingNode(WebCore::FocusDirection) const + 128
Modified: trunk/LayoutTests/js/parser-syntax-check-expected.txt (202647 => 202648)
--- trunk/LayoutTests/js/parser-syntax-check-expected.txt 2016-06-29 21:23:29 UTC (rev 202647)
+++ trunk/LayoutTests/js/parser-syntax-check-expected.txt 2016-06-29 21:48:17 UTC (rev 202648)
@@ -1099,6 +1099,20 @@
--"
PASS Invalid: "function f() { 1 %
-- }"
+PASS Invalid: "let {w} = (foo-=()), {} = ("a" ^= "b");"
+PASS Invalid: "function f() { let {w} = (foo-=()), {} = ("a" ^= "b"); }"
+PASS Invalid: "const {w} = (foo-=()), {} = ("a" ^= "b");"
+PASS Invalid: "function f() { const {w} = (foo-=()), {} = ("a" ^= "b"); }"
+PASS Invalid: "var {w} = (foo-=()), {} = ("a" ^= "b");"
+PASS Invalid: "function f() { var {w} = (foo-=()), {} = ("a" ^= "b"); }"
+PASS Invalid: "let {w} = ();"
+PASS Invalid: "function f() { let {w} = (); }"
+PASS Invalid: "let {w} = 1234abc;"
+PASS Invalid: "function f() { let {w} = 1234abc; }"
+PASS Invalid: "const {w} = 1234abc;"
+PASS Invalid: "function f() { const {w} = 1234abc; }"
+PASS Invalid: "var {w} = 1234abc;"
+PASS Invalid: "function f() { var {w} = 1234abc; }"
Rest parameter
PASS Valid: "function foo(...a) { }"
PASS Valid: "function f() { function foo(...a) { } }"
Modified: trunk/LayoutTests/js/script-tests/parser-syntax-check.js (202647 => 202648)
--- trunk/LayoutTests/js/script-tests/parser-syntax-check.js 2016-06-29 21:23:29 UTC (rev 202647)
+++ trunk/LayoutTests/js/script-tests/parser-syntax-check.js 2016-06-29 21:48:17 UTC (rev 202648)
@@ -657,6 +657,13 @@
invalid("1 % --");
invalid("1 % \n++");
invalid("1 % \n--");
+invalid('let {w} = (foo-=()), {} = ("a" ^= "b");');
+invalid('const {w} = (foo-=()), {} = ("a" ^= "b");');
+invalid('var {w} = (foo-=()), {} = ("a" ^= "b");');
+invalid('let {w} = ();');
+invalid('let {w} = 1234abc;');
+invalid('const {w} = 1234abc;');
+invalid('var {w} = 1234abc;');
debug("Rest parameter");
valid("function foo(...a) { }");
Modified: trunk/Source/_javascript_Core/ChangeLog (202647 => 202648)
--- trunk/Source/_javascript_Core/ChangeLog 2016-06-29 21:23:29 UTC (rev 202647)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-06-29 21:48:17 UTC (rev 202648)
@@ -1,3 +1,17 @@
+2016-06-29 Saam barati <[email protected]>
+
+ Destructuring variable declaration is missing a validation of the syntax of a sub production when there is a rhs
+ https://bugs.webkit.org/show_bug.cgi?id=159267
+
+ Reviewed by Mark Lam.
+
+ We were parsing something without checking if it had a syntax error.
+ This is wrong for many reasons, but it could actually cause a crash
+ in a debug build if you parsed particular programs.
+
+ * parser/Parser.cpp:
+ (JSC::Parser<LexerType>::parseVariableDeclarationList):
+
2016-06-29 Joseph Pecoraro <[email protected]>
Web Inspector: Show Shadow Root type in DOM Tree
Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (202647 => 202648)
--- trunk/Source/_javascript_Core/parser/Parser.cpp 2016-06-29 21:23:29 UTC (rev 202647)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp 2016-06-29 21:48:17 UTC (rev 202648)
@@ -733,6 +733,8 @@
if (hasInitializer) {
next(TreeBuilder::DontBuildStrings); // consume '='
TreeExpression rhs = parseAssignmentExpression(context);
+ propagateError();
+ ASSERT(rhs);
node = context.createDestructuringAssignment(location, pattern, rhs);
lastInitializer = rhs;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes