|
33 | 33 | ;; Fill all of memory |
34 | 34 | (invoke "fill" (i32.const 0) (i32.const 0) (i32.const 0x10000)) |
35 | 35 |
|
36 | | -;; Out-of-bounds writes trap, but all previous writes succeed. |
37 | | -(assert_trap (invoke "fill" (i32.const 0xff00) (i32.const 1) (i32.const 0x101)) |
38 | | - "out of bounds memory access") |
39 | | -(assert_return (invoke "load8_u" (i32.const 0xff00)) (i32.const 1)) |
40 | | -(assert_return (invoke "load8_u" (i32.const 0xffff)) (i32.const 1)) |
41 | | - |
42 | 36 | ;; Succeed when writing 0 bytes at the end of the region. |
43 | 37 | (invoke "fill" (i32.const 0x10000) (i32.const 0) (i32.const 0)) |
44 | 38 |
|
45 | | -;; Fail on out-of-bounds when writing 0 bytes outside of memory. |
46 | | -(assert_trap (invoke "fill" (i32.const 0x10001) (i32.const 0) (i32.const 0)) |
47 | | - "out of bounds memory access") |
48 | | - |
| 39 | +;; OK to write 0 bytes outside of memory. |
| 40 | +(invoke "fill" (i32.const 0x10001) (i32.const 0) (i32.const 0)) |
49 | 41 |
|
50 | 42 | ;; memory.copy |
51 | 43 | (module |
|
105 | 97 | (invoke "copy" (i32.const 0xff00) (i32.const 0) (i32.const 0x100)) |
106 | 98 | (invoke "copy" (i32.const 0xfe00) (i32.const 0xff00) (i32.const 0x100)) |
107 | 99 |
|
108 | | -;; Out-of-bounds writes trap, but all previous writes succeed. |
109 | | -(assert_trap (invoke "copy" (i32.const 0xfffe) (i32.const 0) (i32.const 3)) |
110 | | - "out of bounds memory access") |
111 | | -(assert_return (invoke "load8_u" (i32.const 0xfffe)) (i32.const 0xaa)) |
112 | | -(assert_return (invoke "load8_u" (i32.const 0xffff)) (i32.const 0xbb)) |
113 | | - |
114 | 100 | ;; Succeed when copying 0 bytes at the end of the region. |
115 | 101 | (invoke "copy" (i32.const 0x10000) (i32.const 0) (i32.const 0)) |
116 | 102 | (invoke "copy" (i32.const 0) (i32.const 0x10000) (i32.const 0)) |
117 | 103 |
|
118 | | -;; Fail on out-of-bounds when copying 0 bytes outside of memory. |
119 | | -(assert_trap (invoke "copy" (i32.const 0x10001) (i32.const 0) (i32.const 0)) |
120 | | - "out of bounds memory access") |
121 | | -(assert_trap (invoke "copy" (i32.const 0) (i32.const 0x10001) (i32.const 0)) |
122 | | - "out of bounds memory access") |
| 104 | +;; OK copying 0 bytes outside of memory. |
| 105 | +(invoke "copy" (i32.const 0x10001) (i32.const 0) (i32.const 0)) |
| 106 | +(invoke "copy" (i32.const 0) (i32.const 0x10001) (i32.const 0)) |
123 | 107 |
|
124 | 108 | ;; memory.init |
125 | 109 | (module |
|
154 | 138 | (invoke "init" (i32.const 0x10000) (i32.const 0) (i32.const 0)) |
155 | 139 | (invoke "init" (i32.const 0) (i32.const 4) (i32.const 0)) |
156 | 140 |
|
157 | | -;; Fail on out-of-bounds when writing 0 bytes outside of memory or segment. |
158 | | -(assert_trap (invoke "init" (i32.const 0x10001) (i32.const 0) (i32.const 0)) |
159 | | - "out of bounds memory access") |
160 | | -(assert_trap (invoke "init" (i32.const 0) (i32.const 5) (i32.const 0)) |
161 | | - "out of bounds memory access") |
| 141 | +;; OK writing 0 bytes outside of memory or segment. |
| 142 | +(invoke "init" (i32.const 0x10001) (i32.const 0) (i32.const 0)) |
| 143 | +(invoke "init" (i32.const 0) (i32.const 5) (i32.const 0)) |
162 | 144 |
|
163 | 145 | ;; data.drop |
164 | 146 | (module |
|
0 commit comments