Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Validation for Element Segment Initialization #2526

Open
Q1IQ opened this issue Jan 9, 2025 · 0 comments
Open

Incorrect Validation for Element Segment Initialization #2526

Q1IQ opened this issue Jan 9, 2025 · 0 comments

Comments

@Q1IQ
Copy link

Q1IQ commented Jan 9, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant