Bug 188788 - LEBDecoder and Wasm::Parser should be tolerant for not enough data
Summary: LEBDecoder and Wasm::Parser should be tolerant for not enough data
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-21 05:32 PDT by Yusuke Suzuki
Modified: 2018-08-26 14:58 PDT (History)
5 users (show)

See Also:


Attachments
Patch (49.93 KB, patch)
2018-08-21 05:35 PDT, Yusuke Suzuki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2018-08-21 05:32:36 PDT
LEBDecoder and Wasm::Parser should be tolerant for not enough data
Comment 1 Yusuke Suzuki 2018-08-21 05:35:42 PDT
Created attachment 347632 [details]
Patch
Comment 2 EWS Watchlist 2018-08-21 05:37:18 PDT
Attachment 347632 [details] did not pass style-queue:


ERROR: Source/JavaScriptCore/wasm/WasmParser.h:237:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
Total errors found: 1 in 9 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Saam Barati 2018-08-21 19:50:15 PDT
Comment on attachment 347632 [details]
Patch

Seems like we’re doing this at such a low level. Why can’t we wait until we have enough bytes for the module header then just know when we can individually parse functions at their byte boundaries?
Comment 4 Yusuke Suzuki 2018-08-25 04:25:27 PDT
(In reply to Saam Barati from comment #3)
> Comment on attachment 347632 [details]
> Patch
> 
> Seems like we’re doing this at such a low level. Why can’t we wait until we
> have enough bytes for the module header then just know when we can
> individually parse functions at their byte boundaries?

Make sense. After reading Wasm module specification carefully, we do not need to have such a low level tolerance in LEBDecoder etc. Closing this issue. Without it, we can construct streaming decoder for wasm.