sjcl
sjcl copied to clipboard
Chrome/59/Android zero-fill-right-shift bug in decrypt
Hi, just checking if anybody has the same problem.
I narrowed it down to this line:
file: core/codecString.js
line: 20
out += String.fromCharCode(tmp >>> 24);
the zero fill right shift seems to not work all the time (very intermittent) with chrome 59 on android 6/7. Haven't seen the problem with Chrome 58, 59, 60 on MacOS/X, Linux, Windows.
To fix it I changed the line to:
out += String.fromCharCode(((tmp&0xff000000) >>> 24)&0x000000ff);
Haven't played with the masks to see if one or the other makes it work or if I need both. Will do some more tests tomorrow.
Will fill a bug report with Chrome tomorrow....
Thanks.
I can confirm that this issue seems to appear in latest Chrome on Android - more precisely, it seems the issue is in the Android System WebView
which was updated on 30th of June.
Your hotfix seems to work. Have you had time to report this issue to Chrome?
We're seeing this too but not quite so intermittently. On affected devices it breaks reliably every time. The workaround supplied by @sebjoub appears to fix it.
This is a bug in Chrome I am already in contact with the Chrome Team and will open a bug with them today.
There is an easier fix though, replace the last line with
out += String.fromCharCode(tmp >>> 8 >>> 8 >>> 8);
This only happens after a certain ramp-up phase. Likely happens because of an invalid optimization for ARM CPUs on a later optimization step
@sebjoub have you already filed a bug report with the Chrome team? If so please post a link.
I published [email protected] which contains my fix for the problem. Thanks @sebjoub for the bug report.
No I have not posted a bug report with the chrome team. I thought @Nilos did.
Here is the URL for the chromium bug report: https://bugs.chromium.org/p/chromium/issues/detail?id=739175#
Could anyone confirm exactly which Android devices this affects? We need to decide on whether to issue an urgent patch to our Cordova app. Is it a specific combination of Android version and Chrome version, or something else? I cannot replicate it on my Nexus 6P with Chrome 59 and Android 7.1.1.
@jezbo7
sjcl v1.0.6
Android System WebView v59.0.3071.125
However, as @Nilos pointed out, the behaviour was inconsistent and only happened after a certain ramp-up phase.