Closed blickly closed 9 years ago
I suspect this is a bug in the cryptography code. Closure Compiler is flagging code
that's very likely to be
incorrect.
Although most numbers in JavaScript are represented as floating point numbers, bitwise
operators are
represented as 32 bit integers. The shift operators only work on integers, so 2<<32
is going to shift the bits
off the end of the integer. If you try this out in Firefox, you'll find that alert(2<<32)
returns 2, alert(2<<31)
returns 0, and alert(2<<30) returns -2147483648. I don't think that's what they intended.
Considering the offending code is checking if the length of the array to be encrypted
is greater than 2^16 but
less than 2^32, I suspect no one's noticed this because they've never encrypted strings
longer than 65K. I'm
also surprised they're not doing 1<<32 to get 2^32 rather than 2^33, but don't know
if this was intentional.
Original issue reported on code.google.com by bowdidge@google.com
on 2009-12-17 17:28:26
Marking as behaves correctly/will not fix. If you think this really is a bug, let us
know why in the bug and we'll
see what we can do.
Original issue reported on code.google.com by bowdidge@google.com
on 2009-12-18 17:08:52
Original issue reported on code.google.com by
grepular
on 2009-12-17 15:27:02