Closed Bug 1101265 Opened 5 years ago Closed 5 years ago

Infinite automatic semicolon insertion before invalid arrow function syntax.

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: arai, Assigned: arai)

References

Details

(Keywords: clownshoes, csectype-dos, regression)

Attachments

(1 file, 1 obsolete file)

Parser falls into infinite loop with following code:

  1
  )=>

Semicolon is inserted automatically and infinitely before TOK_RP,
because primaryExpr returns null literal for TOK_RP without consuming any token.
TOK_RP in primaryExpr is allowed only if it's just after TOK_LP.
Attachment #8525036 - Flags: review?(jwalden+bmo)
This seems to be the regression by bug 846406.
Confirmed that this happens on Nightly 22.0a1(2013-03-20), with evaluating following code in console:

  eval("1\n)=>")

and memory usage grows rapidly.
Blocks: 846406
Group: core-security
Blocks: 1089045
Comment on attachment 8525036 [details] [diff] [review]
Parse empty arrow function parameter only in the right place.

clearing r? for now,
I'll post the fixed one after try run.
Attachment #8525036 - Flags: review?(jwalden+bmo)
Comment on attachment 8535983 [details] [diff] [review]
Simplify parsing empty arrow function parameter.

Review of attachment 8535983 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/frontend/Parser.cpp
@@ +8110,5 @@
> +        // with no params: `() => body`.
> +        tokenStream.consumeKnownToken(next);
> +
> +        if (!tokenStream.peekToken(&next))
> +            return null();

I was going to say add a test for this to that big test with all the @ in it...but such a test already exists in that test.  \o/
Attachment #8535983 - Flags: review?(jwalden+bmo) → review+
https://hg.mozilla.org/mozilla-central/rev/5ac338f56e42
Assignee: nobody → arai_a
Status: NEW → RESOLVED
Closed: 5 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
You need to log in before you can comment on or make changes to this bug.