Skip to content

Missing defaultable validation in array.new_default instruction #4853

@Q1IQ

Description

@Q1IQ

iwasm fails to reject an invalid WebAssembly module involving the array.new_default instruction. Specifically, The element type is (ref $struct_no_default) where. According to the WebAssembly specification, The type t must be defaultable.

Test case

arraynewdefault.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:

0x5: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 validate: array.new_default index 1 does not reference an array definition with a defaultable type, in function at index 0 

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions