Bug 188788

Summary: LEBDecoder and Wasm::Parser should be tolerant for not enough data
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: New BugsAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED WONTFIX    
Severity: Normal CC: darin, ews-watchlist, keith_miller, mark.lam, saam
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

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.