Unexpected section: 0x6
phiresky opened this issue · comments
phiresky commented
When trying to parse the attached wasm module, webpack throws the above error.
When using the wasm-parser api directly, it shows this:
Failed to decode custom "name" section @5033477; ignoring (Maximum call stack size exceeded).
Uncaught Error: Unexpected section: 0x6
at new CompileError (node_modules/@webassemblyjs/helper-api-error/lib/index.js:40:109)
at parseSection (node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1329:76)
the file is valid according to wasm-objdump etc:
b.wasm: file format wasm 0x1
Sections:
Type start=0x0000000e end=0x000002bf (size=0x000002b1) count: 100
Import start=0x000002c5 end=0x00000352 (size=0x0000008d) count: 3
Function start=0x00000358 end=0x00004342 (size=0x00003fea) count: 16360
Table start=0x00004348 end=0x0000434f (size=0x00000007) count: 1
Memory start=0x00004355 end=0x00004358 (size=0x00000003) count: 1
Global start=0x0000435e end=0x00004367 (size=0x00000009) count: 1
Export start=0x0000436d end=0x000043e2 (size=0x00000075) count: 6
Elem start=0x000043e8 end=0x00004c04 (size=0x0000081c) count: 1
Code start=0x00004c0a end=0x00407c45 (size=0x0040303b) count: 16360
Data start=0x00407c4b end=0x0044b30c (size=0x000436c1) count: 2
Custom start=0x0044b312 end=0x005c7e00 (size=0x0017caee) "name"
Custom start=0x005c7e06 end=0x005c7e7d (size=0x00000077) "producers"
phiresky commented
The same file is also works correctly in browsers
phiresky commented
replacing this:
webassemblyjs/packages/wasm-parser/src/decoder.js
Line 1836 in 0fb788b
with offset = startLoc + sectionSizeInBytes
works, so seems like the issue is the offset is wrong after failing to decode the name section.