Files
wasmtime/tests/all/cli_tests/wasi_misaligned_pointer.wat
Alex Crichton 615d697a0b Update preview1 to trap on misaligned pointers (#6776)
* Update preview1 to trap on misaligned pointers

Previously Wasmtime would return `EINVAL` to a guest but the upstream
documentation indicates that misaligned pointers should trap, so this
commit updates the alignment error to get converted into a trap rather
than than being returned to the guest.

* Change OOB errors to traps too

* Update preview2's implementation of preview1

* Handle some more errors
2023-08-02 22:15:32 +00:00

17 lines
350 B
WebAssembly Text Format

(module
(import "wasi_snapshot_preview1" "fd_write" (func $write (param i32 i32 i32 i32) (result i32)))
(memory (export "memory") 1)
(func (export "_start")
(call $write
(i32.const 1) ;; fd=1
(i32.const 1) ;; ciovec_base=1 (misaligned)
(i32.const 1) ;; ciovec_len=1
(i32.const 0) ;; retptr=0
)
drop
)
)