New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 764956 link

Starred by 3 users

Issue metadata

Status: Assigned
Owner:
Last visit > 30 days ago
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 3
Type: Bug-Regression



Sign in to add a comment

asm.js parsing regression related to unnecessary parens

Reported by scott.no...@gmail.com, Sep 13 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36

Steps to reproduce the problem:
1. Add Signal Desktop development version in chrome://extensions https://github.com/WhisperSystems/Signal-Desktop/blob/master/CONTRIBUTING.md
2. Launch extension
3. Right-click and select 'Inspect Background Page'

What is the expected behavior?
No warning. No previous version of Chrome since I started on the project in May has shown this warning.

What went wrong?
Warning in the console: "Invalid asm.js: Unexpected token"

The two problematic lines are:

HEAP32[((ptr)>>2)]=value4;

and

HEAP32[((dest)>>2)]=((HEAP32[((src)>>2)])|0);

They can each be fixed by removing all of the extra parens. But again, this is something that worked up until very recently.

Did this work before? Yes 60.x

Chrome version: 61.0.3163.79  Channel: stable
OS Version: OS X 10.11.6
Flash Version:
 
Screen Shot 2017-09-13 at 11.43.36 AM.png
92.8 KB View Download
Labels: Needs-Triage-M61 Needs-Bisect
Components: Blink>JavaScript>Parser
Labels: -Pri-2 -Needs-Bisect M-61 hasbisect OS-Linux OS-Windows Pri-1
Owner: bradnelson@chromium.org
Status: Assigned (was: Unconfirmed)
Able to reproduce the issue on Windows 10, mac 10.12.6 and Ubuntu 14.04 using chrome reported version #61.0.3163.79 and latest canary #63.0.3214.0.

Bisect Information:
=====================
Good build: 61.0.3163.53  Revision(359969)
Bad Build : 61.0.3163.54  Revision(360248)

Change Log URL: 
https://chromium.googlesource.com/chromium/src/+log/61.0.3163.53..61.0.3163.54?pretty=fuller&n=10000

From the above change log suspecting below change
Change-Id: I798cc67255d07bbd8404254ec0b6332e77ec0452
Reviewed-on: https://chromium-review.googlesource.com/619293

bradnelson@ - Could you please check whether this is caused with respect to your change, if not please help us in assigning it to the right owner.
Also could you please confirm if it can be marked as a stable blocker as the issue is broken in M61 and can it be considered for next stable refresh.

Thanks...!!
Components: -Blink
Cc: mstarzinger@chromium.org
Labels: -Pri-1 -M-61 -Needs-Triage-M61 Pri-3
The new asm.js validator doesn't materialize a full ast so there some places where it's less generous in terms of the grammar. Though as this is just a matter of extra parens, this is probably supposed to be allowed by the spec. Getting this right might require infinite rewind, or something clever to avoid relying on local pattern matching.

It's less that it was working before the change, than that the old pipeline wasn't deciding which asm.js is valid. For 61, this just means it won't hit the new pipeline, though in later versions this will also mean the code won't be optimized at all.
We should probably fix, but not sure the priority.

Did this asm.js come from emscripten or some other source?

Trying if a simple local fix can work.

I'm not sure how it was generated, but it was generated quite a while ago. Since it's sensitive encryption code, it's not something we change very often.
Okay, just got confirmation that it was emscripten

Comment 8 by caiiiy...@gmail.com, Oct 31 2017

Have the same problem with unity game converted to js with emscripten + sfe. Archive with game attached. Just run testing-unity.html in chrome and you will see warning:

Invalid asm.js: Unexpected token

In FF this code compiles without error.
uplatformer.zip
7.3 MB Download

Comment 9 by caiiiy...@gmail.com, Oct 31 2017

Ok, I found that in my case there is no extra parens. To find where problem I use sed:

sed -i "s/0;/0;\n/ig" bin.asm.code.unityweb

After doing this I have this error:

bin.asm.code.unityweb:419968 Invalid asm.js: Unexpected token

Problem line:
c[$<<2>>2]=a;return}function $$F(a,$){a=a|0;

After digging I found that problem is in:
$<<2>>2

If I replace it with ($<<2)>>2 then it pass validation on this line. 
After that I replace all similar places with sed:

sed -i "s/\([A-Za-z$]\)<<2>>2/(\\1<<2)>>2/ig" bin.asm.code.unityweb

and this solve the problem.


Should I fill a new bug report?
I guess filing a new bug report makes sense (cc bradnelson, mstarzinger)

Sign in to add a comment