Changeset 202648 in webkit


Ignore:
Timestamp:
Jun 29, 2016 2:48:17 PM (8 years ago)
Author:
sbarati@apple.com
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/JavaScriptCore:

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:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r202647 r202648  
     12016-06-29  Saam barati  <sbarati@apple.com>
     2
     3        Destructuring variable declaration is missing a validation of the syntax of a sub production when there is a rhs
     4        https://bugs.webkit.org/show_bug.cgi?id=159267
     5
     6        Reviewed by Mark Lam.
     7
     8        * js/parser-syntax-check-expected.txt:
     9        * js/script-tests/parser-syntax-check.js:
     10
    1112016-06-29  Nan Wang  <n_wang@apple.com>
    212
  • trunk/LayoutTests/js/parser-syntax-check-expected.txt

    r202074 r202648  
    11001100PASS Invalid: "function f() { 1 %
    11011101-- }"
     1102PASS Invalid: "let {w} = (foo-=()), {} = ("a" ^= "b");"
     1103PASS Invalid: "function f() { let {w} = (foo-=()), {} = ("a" ^= "b"); }"
     1104PASS Invalid: "const {w} = (foo-=()), {} = ("a" ^= "b");"
     1105PASS Invalid: "function f() { const {w} = (foo-=()), {} = ("a" ^= "b"); }"
     1106PASS Invalid: "var {w} = (foo-=()), {} = ("a" ^= "b");"
     1107PASS Invalid: "function f() { var {w} = (foo-=()), {} = ("a" ^= "b"); }"
     1108PASS Invalid: "let {w} = ();"
     1109PASS Invalid: "function f() { let {w} = (); }"
     1110PASS Invalid: "let {w} = 1234abc;"
     1111PASS Invalid: "function f() { let {w} = 1234abc; }"
     1112PASS Invalid: "const {w} = 1234abc;"
     1113PASS Invalid: "function f() { const {w} = 1234abc; }"
     1114PASS Invalid: "var {w} = 1234abc;"
     1115PASS Invalid: "function f() { var {w} = 1234abc; }"
    11021116Rest parameter
    11031117PASS Valid:   "function foo(...a) { }"
  • trunk/LayoutTests/js/script-tests/parser-syntax-check.js

    r202074 r202648  
    658658invalid("1 % \n++");
    659659invalid("1 % \n--");
     660invalid('let {w} = (foo-=()), {} = ("a" ^= "b");');
     661invalid('const {w} = (foo-=()), {} = ("a" ^= "b");');
     662invalid('var {w} = (foo-=()), {} = ("a" ^= "b");');
     663invalid('let {w} = ();');
     664invalid('let {w} = 1234abc;');
     665invalid('const {w} = 1234abc;');
     666invalid('var {w} = 1234abc;');
    660667
    661668debug("Rest parameter");
  • trunk/Source/JavaScriptCore/ChangeLog

    r202634 r202648  
     12016-06-29  Saam barati  <sbarati@apple.com>
     2
     3        Destructuring variable declaration is missing a validation of the syntax of a sub production when there is a rhs
     4        https://bugs.webkit.org/show_bug.cgi?id=159267
     5
     6        Reviewed by Mark Lam.
     7
     8        We were parsing something without checking if it had a syntax error.
     9        This is wrong for many reasons, but it could actually cause a crash
     10        in a debug build if you parsed particular programs.
     11
     12        * parser/Parser.cpp:
     13        (JSC::Parser<LexerType>::parseVariableDeclarationList):
     14
    1152016-06-29  Joseph Pecoraro  <pecoraro@apple.com>
    216
  • trunk/Source/JavaScriptCore/parser/Parser.cpp

    r202280 r202648  
    734734                next(TreeBuilder::DontBuildStrings); // consume '='
    735735                TreeExpression rhs = parseAssignmentExpression(context);
     736                propagateError();
     737                ASSERT(rhs);
    736738                node = context.createDestructuringAssignment(location, pattern, rhs);
    737739                lastInitializer = rhs;
Note: See TracChangeset for help on using the changeset viewer.