WebAssembly / WebAssembly/spec
assert_invalid and assert_malformed produce inconsistent JS tests
Nobody has claimed this yet.
- Dominant language
- WebAssembly
- Stars
- 3.5k
- Forks
- 539
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 13
Description
I observed this on the address.wast test, line 213:
(assert_malformed
(module quote
"(memory 1)"
"(func (drop (i32.load offset=4294967296 (i32.const 0))))"
)
"i32 constant"
)
Converted to JS via the spec interpreter (./wasm -d address.wast -o address.js), it produces this check:
assert_malformed("\x3c\x6d\x61\x6c\x66\x6f\x72\x6d\x65\x64\x20\x71\x75\x6f\x74\x65\x3e");
This checks that the string <malformed quote> is considered invalid Wasm, which is not a sensible test.
I am not sure what we should do instead, I guess the underlying problem is that the interpreter cannot convert the WAT to binary, so there is not much it can do. Maybe it should skip the test instead?
The same happens with assert_invalid and any invalid string, e.g.
(assert_invalid
(module quote "(foobar)")
"foobar"
)
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
Reproduce the conversion with ./wasm -d address.wast -o address.js, starting from the assert_malformed and assert_invalid cases in address.wast. Compare how the generated address.js checks handle quoted WAT that cannot be converted to binary. Done should ensure these generated checks do not treat the placeholder malformed value as a meaningful invalid Wasm test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- wasm
- Domain
- compilers, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100