-
Notifications
You must be signed in to change notification settings - Fork 750
Description
Test case
(module
(type $0 (func (result f64)))
(memory $0 0 0)
(export "main" (func 0))
(func $0
(type 0)
(f64.const 1.234)
(i32.const 7)
(f64.load offset=4 align=4)
(drop)
)
)
Describe the bug
When executing the module with iwasm, the behavior differs across execution modes.
$ iwasm -f main test1.wasm
1.234:f64
$ iwasm --llvm-jit -f main test1.wasm
1.234:f64
$ iwasm --interp -f main test1.wasm
Exception: out of bounds memory access
The module performs an f64.load from a memory with zero size, which should always trap with an out-of-bounds memory access.
However, in fast-interp and JIT modes, iwasm does not trap. Instead, it continues execution and returns the previous f64.const 1.234 value, as if the out-of-bounds f64.load had been silently ignored.
This seems that in fast-interp and JIT modes, iwasm incorrectly omits the required bounds check for f64.load when its result is dropped.
Version
iwasm 2.4.4
ubuntu 20.04
To Reproduce
Steps to reproduce the behavior:
- Compile iwasm with flags like '-DWAMR_BUILD_JIT=1 -DWAMR_BUILD_TAIL_CALL=1 -DWAMR_BUILD_GC=1'
- Run iwasm with CLI options like 'iwasm -f main test1.wasm'
- See error
Expected behavior
Exception: out of bounds memory access
Actual Result
1.234:f64
Desktop (please complete the following information):
- Arch x86_64
- OS ubuntu 20.04