Fast interpreter: issue with decoding block types
Open
Nobody has claimed this yet.
- Dominant language
- WebAssembly
- Stars
- 512
- Forks
- 51
- Avg merge
- 7h 34m
- Merged PRs (30d)
- 21
Description
It seems that the fast interpreter can miscompute the length of a block type. I think this happens for multi-byte type indexes. I get this trace for the piece of code below:
jerome@catalpa:~/tmp/bugs$ ~/sources/wizard-engine/bin/spectest.x86-64-linux -ti bug.bin.wast
##+bug.bin.wast
+1: block[[] -> [i32 i32]]
+3: unreachable
##-fail: bug.bin.wast @ 21:2 assert_return expected [], got trap[UNREACHABLE]
(module
(type (func)) (type (func)) (type (func)) (type (func))
(type (func)) (type (func)) (type (func)) (type (func))
(type (func)) (type (func)) (type (func)) (type (func))
(type (func)) (type (func)) (type (func)) (type (func))
(type (func)) (type (func)) (type (func)) (type (func))
(type (func)) (type (func)) (type (func)) (type (func))
(type (func)) (type (func)) (type (func)) (type (func))
(type (func)) (type (func)) (type (func)) (type (func))
(type (func)) (type (func)) (type (func)) (type (func))
(type (func)) (type (func)) (type (func)) (type (func))
(type (func)) (type (func)) (type (func)) (type (func))
(type (func)) (type (func)) (type (func)) (type (func))
(type (func)) (type (func)) (type (func)) (type (func))
(type (func)) (type (func)) (type (func)) (type (func))
(type (func)) (type (func)) (type (func)) (type (func))
(type (func)) (type (func)) (type (func)) (type (func))
(type (func))
(type $res (func (result i32 i32)))
(func (export "main")
(block (type $res)
(return))
(drop)
(drop)
)
)
(assert_return (invoke "main"))
(module definition binary
"\00\61\73\6d\01\00\00\00\01\c9\81\80\80\00\42\60"
"\00\00\60\00\00\60\00\00\60\00\00\60\00\00\60\00"
"\00\60\00\00\60\00\00\60\00\00\60\00\00\60\00\00"
"\60\00\00\60\00\00\60\00\00\60\00\00\60\00\00\60"
"\00\00\60\00\00\60\00\00\60\00\00\60\00\00\60\00"
"\00\60\00\00\60\00\00\60\00\00\60\00\00\60\00\00"
"\60\00\00\60\00\00\60\00\00\60\00\00\60\00\00\60"
"\00\00\60\00\00\60\00\00\60\00\00\60\00\00\60\00"
"\00\60\00\00\60\00\00\60\00\00\60\00\00\60\00\00"
"\60\00\00\60\00\00\60\00\00\60\00\00\60\00\00\60"
"\00\00\60\00\00\60\00\00\60\00\00\60\00\00\60\00"
"\00\60\00\00\60\00\00\60\00\00\60\00\00\60\00\00"
"\60\00\00\60\00\00\60\00\00\60\00\00\60\00\00\60"
"\00\00\60\00\02\7f\7f\03\82\80\80\80\00\01\00\07"
"\88\80\80\80\00\01\04\6d\61\69\6e\00\00\0a\8f\80"
"\80\80\00\01\89\80\80\80\00\00\02\c1\00\0f\0b\1a"
"\1a\0b"
)
(module instance)
(assert_return (invoke "main"))
Contributor guide
No contributing guide indexed for this repository
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 by running the supplied bug.bin.wast reproduction with bin/spectest.x86-64-linux -ti and compare the fast interpreter's block-type decoding for the multi-byte type index. Trace why the block is reported with the wrong result types; done means the supplied assert_return passes without an UNREACHABLE trap.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- wasm
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100