iwasm fails to reject an invalid WebAssembly module involving the struct.new_default instruction. Specifically, Field type is (ref $T) which is non-nullable and NOT defaultable. According to the WebAssembly specification, - The type t_i must be defaultable.
Test case
struct.new_default.wasm.txt
Environment
- OS: Ubuntu 20.04
- CPU: amd64
- iwasm version:
c46b10dc
- Commands:
wasm-micro-runtime/product-mini/platforms/linux/build/iwasm --interp -f run test.wasm
Actual behavior
iwasm incorrectly accepts this invalid module (exit code 0). The output is:
0x0:i32
Performance profiler data:
func run, execution time: 0.007 ms, execution count: 1 times, children execution time: 0.000 ms
Expected behavior
The runtime should reject this module during validation because the module violates the specification.
Exception: CompileError: WebAssembly.Module doesn't parse at byte 4: struct.new_default 1 requires all fields to be defaultable, but field 0 has type Ref, in function at index 0
iwasmfails to reject an invalid WebAssembly module involving thestruct.new_defaultinstruction. Specifically, Field type is (ref $T) which is non-nullable and NOT defaultable. According to the WebAssembly specification, - The type t_i must be defaultable.Test case
struct.new_default.wasm.txt
Environment
c46b10dcActual behavior
iwasmincorrectly accepts this invalid module (exit code 0). The output is:Expected behavior
The runtime should reject this module during validation because the module violates the specification.
Exception: CompileError: WebAssembly.Module doesn't parse at byte 4: struct.new_default 1 requires all fields to be defaultable, but field 0 has type Ref, in function at index 0