WebAssembly / WebAssembly/binaryen
Slow to disassemble some crafted wasm files
Nobody has claimed this yet.
- Dominant language
- WebAssembly
- Stars
- 8.6k
- Forks
- 885
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 69
Description
wasm-dis may sometimes spend too much time to disassemble certain crafted wasm files.
wasm-dis-slow.zip
It turns out that inside WasmBinaryBuilder::readFunctions(), at https://github.com/WebAssembly/binaryen/blob/master/src/wasm/wasm-binary.cpp#L1073-L1080, the value num may get extremely large (I haven't figured out why yet), and subsequent operations require too much time to finish.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied wasm-dis-slow.zip and inspect WasmBinaryBuilder::readFunctions() in src/wasm/wasm-binary.cpp around lines 1073-1080, focusing on how the value num is obtained and used. Reproduce the slow disassembly and determine why num becomes extremely large. Done means the crafted file no longer causes wasm-dis to spend excessive time.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, wasm
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100