[Webkit-unassigned] [Bug 147393] Parse the entire WebAssembly modules
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Jul 31 16:21:41 PDT 2015
https://bugs.webkit.org/show_bug.cgi?id=147393
--- Comment #13 from Sukolsak Sakshuwong <sukolsak at gmail.com> ---
Thanks.
(In reply to comment #10)
> 1. Use a do-while loop because it is more succinct and easier to read.
Done.
> 2. Use a uint64_t local value instead of storing into the result directly.
> Using the local allows the compiler to put it in a register, and register
> operations are cheap. We only incur the memory write to result at the end.
Used a local value.
> 3. When the computation is done,
> (1) break out of the loop,
> (2) validate that the computed value is within size of a uint32, and
> (3) copy the local value into the result.
>
> 4. The loop can loop while (value < numeric_limits<uint32_t>::max()). This
> ensures that we don't overflow our uint64_t local value and that the
> validation check in 3.2 will work as expected.
As discussed on IRC, checking that (value < numeric_limits<uint32_t>::max()) is not enough, because the bytes could be 0x80 0x80 0x80 0x80 0x80 ... . Checking that the number of bytes doesn't exceed 5 and that the fifth byte is <= 0b00001111 should prevent that and also eliminate the need for uint64_t.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150731/cdcc701a/attachment.html>
More information about the webkit-unassigned
mailing list