wabt icon indicating copy to clipboard operation
wabt copied to clipboard

Incorrect Validation for Element Segment Initialization

Open Q1IQ opened this issue 1 year ago • 0 comments

wasm-interp does not correctly handle element segment initialization using global.get for non-imported globals.

Test case

program.wasm program.wasm.txt

Environment

  • OS: Ubuntu 20.04
  • CPU: amd64
  • WABT version: 1.0.36
  • Commands:
./wasm-interp --enable-all --run-export=main ./program.wasm

Actual behavior


/path/to/wabt/bin/wasm-validate --enable-all --run-export=main /path/to/test/program.wasm
error: initializer expression can only reference an imported global

Expected Behavior

Element segment offset expressions should be able to reference both imported and non-imported globals. The module should pass validation without errors.

Q1IQ avatar Jan 09 '25 12:01 Q1IQ