85
85
(func (export "test")
86
86
(data.drop 0)
87
87
(data.drop 0)))
88
- (assert_trap ( invoke "test") "data segment dropped ")
88
+ (invoke "test")
89
89
` ) ;
90
90
91
91
// drop, then init
95
95
(func (export "test")
96
96
(data.drop 0)
97
97
(memory.init 0 (i32.const 1234) (i32.const 1) (i32.const 1))))
98
- (assert_trap (invoke "test") "data segment dropped ")
98
+ (assert_trap (invoke "test") "out of bounds ")
99
99
` ) ;
100
100
101
101
// init with data seg ix indicating an active segment
@@ -105,7 +105,7 @@ print(
105
105
(data (i32.const 0) "\\37")
106
106
(func (export "test")
107
107
(memory.init 0 (i32.const 1234) (i32.const 1) (i32.const 1))))
108
- (assert_trap (invoke "test") "data segment dropped ")
108
+ (assert_trap (invoke "test") "out of bounds ")
109
109
` ) ;
110
110
111
111
// init with no memory
@@ -164,13 +164,13 @@ print(
164
164
(assert_trap (invoke "test") "out of bounds")
165
165
` ) ;
166
166
167
- // init: seg ix is valid passive, src offset past the end, zero len is always valid
167
+ // init: seg ix is valid passive, src offset past the end, zero len is invalid
168
168
print (
169
169
`(module
170
170
${ PREAMBLE }
171
171
(func (export "test")
172
172
(memory.init 0 (i32.const 1234) (i32.const 4) (i32.const 0))))
173
- (invoke "test")
173
+ (assert_trap ( invoke "test") "out of bounds ")
174
174
` ) ;
175
175
176
176
// init: seg ix is valid passive, zero len, src offset at the end
@@ -182,13 +182,13 @@ print(
182
182
(invoke "test")
183
183
` ) ;
184
184
185
- // init: seg ix is valid passive, dst offset past the end, zero len is always valid
185
+ // init: seg ix is valid passive, dst offset past the end, zero len is invalid
186
186
print (
187
187
`(module
188
188
${ PREAMBLE }
189
189
(func (export "test")
190
190
(memory.init 0 (i32.const 0x10001) (i32.const 0) (i32.const 0))))
191
- (invoke "test")
191
+ (assert_trap ( invoke "test") "out of bounds ")
192
192
` ) ;
193
193
194
194
// init: seg ix is valid passive, zero len, but dst offset at the end
@@ -209,6 +209,16 @@ print(
209
209
(invoke "test")
210
210
` ) ;
211
211
212
+ // init: seg ix is valid passive, src and dst offset past the end, zero len is
213
+ // invalid
214
+ print (
215
+ `(module
216
+ ${ PREAMBLE }
217
+ (func (export "test")
218
+ (memory.init 0 (i32.const 0x10001) (i32.const 4) (i32.const 0))))
219
+ (assert_trap (invoke "test") "out of bounds")
220
+ ` ) ;
221
+
212
222
// invalid argument types. TODO: can add anyfunc etc here.
213
223
{
214
224
const tys = [ 'i32' , 'f32' , 'i64' , 'f64' ] ;
0 commit comments