Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected section: 0x6 #918

Open
phiresky opened this issue May 20, 2021 · 2 comments
Open

Unexpected section: 0x6 #918

phiresky opened this issue May 20, 2021 · 2 comments

Comments

@phiresky
Copy link

phiresky commented May 20, 2021

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"

b.wasm.zip

@phiresky
Copy link
Author

The same file is also works correctly in browsers

@phiresky
Copy link
Author

replacing this:

eatBytes(offset - (initialOffset + remainingBytes));

with offset = startLoc + sectionSizeInBytes works, so seems like the issue is the offset is wrong after failing to decode the name section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant