Skip to content

Segmentation Fault due to Missing Validation of Type Section #4856

@Q1IQ

Description

@Q1IQ

iwasm fails to handle a valid WebAssembly module involving the type section, causing a segmentation fault.

Test case

(module
  (type (;0;) (struct (field i32) (field funcref)))
  (type (;1;) (func (result i32)))
  (global (;0;) (ref 0) i32.const 42 ref.null func struct.new 0)
  (export "run" (func 0))
  (func (;0;) (type 1) (result i32)
    global.get 0
    struct.get 0 0
  )
)

typesection.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

Segmentation fault (core dumped)

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