Skip to content

Commit 14a7d93

Browse files
committed
add a test
1 parent 12c4aed commit 14a7d93

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

wat/wasi/efault.wat

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
;; wasm3, wasm-micro-runtime: trap "out of bounds memory access" trap
2+
;; wasmer, wasmtime: exit with 21
3+
4+
(module
5+
(func $fd_write (import "wasi_snapshot_preview1" "fd_write") (param i32 i32 i32 i32) (result i32))
6+
(func $proc_exit (import "wasi_snapshot_preview1" "proc_exit") (param i32))
7+
(func (export "_start")
8+
;; iov->iov_base = 0xffffffff
9+
i32.const 0
10+
i32.const 0xfffffff0 ;; out of range address
11+
i32.store
12+
;; iov->iov_len = 100
13+
i32.const 4
14+
i32.const 100
15+
i32.store
16+
17+
i32.const 1 ;; fd = STDOUT
18+
i32.const 0 ;; iov_addr
19+
i32.const 1 ;; iov_count
20+
i32.const 8 ;; retp
21+
call $fd_write
22+
call $proc_exit
23+
)
24+
(memory (export "memory") 1)
25+
)

0 commit comments

Comments
 (0)