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 handling of table.init with out-of-bounds element segment #3991

Open
Q1IQ opened this issue Dec 27, 2024 · 0 comments
Open

Incorrect handling of table.init with out-of-bounds element segment #3991

Q1IQ opened this issue Dec 27, 2024 · 0 comments

Comments

@Q1IQ
Copy link

Q1IQ commented Dec 27, 2024

Subject of the issue

WasmEdge fails to correctly handle table.init when attempting out-of-bounds table access, resulting in unexpected behavior or a failure to throw the expected exception.

Test case

(module
  (table 4 funcref)

  (elem (i32.const 0) funcref (ref.null func) (ref.null func))

  (func $main
    (table.init 0 (i32.const 0) (i32.const 0) (i32.const 1))
  )

  (export "main" (func $main) )
)

Your environment

  • OS: Ubuntu 20.04
  • CPU: amd64
  • WAMR version: iwasm 1.2.3
  • Commands:
iwasm --fast-jit -f main ./program.wasm
iwasm --multi-tier-jit -f main./program.wasm

Expected behavior

The WebAssembly runtime should detect the out-of-bounds table access during table.init and report the error. A valid error message should look like:

Out of bounds table access
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