File tree 3 files changed +59
-4
lines changed
3 files changed +59
-4
lines changed Original file line number Diff line number Diff line change @@ -310,11 +310,11 @@ and check_block (c : context) (es : instr list) (ts : stack_type) at =
310
310
(* Types *)
311
311
312
312
let check_limits {min; max} range at msg =
313
- require (I64 . le_u ( Int64. of_int32 min) range) at msg;
313
+ require (I32 . le_u min range) at msg;
314
314
match max with
315
315
| None -> ()
316
316
| Some max ->
317
- require (I64 . le_u ( Int64. of_int32 max) range) at msg;
317
+ require (I32 . le_u max range) at msg;
318
318
require (I32. le_u min max) at
319
319
" size minimum must not be greater than maximum"
320
320
@@ -329,11 +329,11 @@ let check_func_type (ft : func_type) at =
329
329
330
330
let check_table_type (tt : table_type ) at =
331
331
let TableType (lim, _) = tt in
332
- check_limits lim 0x1_0000_0000L at " table size must be at most 2^32"
332
+ check_limits lim 0xffff_ffffl at " table size must be at most 2^32-1 "
333
333
334
334
let check_memory_type (mt : memory_type ) at =
335
335
let MemoryType lim = mt in
336
- check_limits lim 0x1_0000L at
336
+ check_limits lim 0x1_0000l at
337
337
" memory size must be at most 65536 pages (4GiB)"
338
338
339
339
let check_global_type (gt : global_type ) at =
Original file line number Diff line number Diff line change 1
1
;; Test memory section structure
2
2
3
+ (module (memory 0 ))
4
+ (module (memory 1 ))
3
5
(module (memory 0 0 ))
4
6
(module (memory 0 1 ))
5
7
(module (memory 1 256 ))
74
76
" memory size must be at most 65536 pages (4GiB)"
75
77
)
76
78
79
+ (assert_malformed
80
+ (module quote " (memory 0x1_0000_0000)" )
81
+ " i32 constant out of range"
82
+ )
83
+ (assert_malformed
84
+ (module quote " (memory 0x1_0000_0000 0x1_0000_0000)" )
85
+ " i32 constant out of range"
86
+ )
87
+ (assert_malformed
88
+ (module quote " (memory 0 0x1_0000_0000)" )
89
+ " i32 constant out of range"
90
+ )
91
+
77
92
(module
78
93
(memory 1 )
79
94
(data (i32.const 0 ) " ABC\a7 D" ) (data (i32.const 20 ) " WASM" )
Original file line number Diff line number Diff line change
1
+ ;; Test table section structure
2
+
3
+ (module (table 0 funcref ))
4
+ (module (table 1 funcref ))
5
+ (module (table 0 0 funcref ))
6
+ (module (table 0 1 funcref ))
7
+ (module (table 1 256 funcref ))
8
+ (module (table 0 65536 funcref ))
9
+ (module (table 0 0xffff_ffff funcref ))
10
+
11
+ (assert_invalid (module (table 0 funcref ) (table 0 funcref )) " multiple tables" )
12
+ (assert_invalid (module (table (import " spectest" " table" ) 0 funcref ) (table 0 funcref )) " multiple tables" )
13
+
14
+ (assert_invalid (module (elem (i32.const 0 ))) " unknown table" )
15
+ (assert_invalid (module (elem (i32.const 0 ) $f ) (func $f )) " unknown table" )
16
+
17
+
18
+ (assert_invalid
19
+ (module (table 1 0 funcref ))
20
+ " size minimum must not be greater than maximum"
21
+ )
22
+ (assert_invalid
23
+ (module (table 0xffff_ffff 0 funcref ))
24
+ " size minimum must not be greater than maximum"
25
+ )
26
+
27
+ (assert_malformed
28
+ (module quote " (table 0x1_0000_0000 funcref)" )
29
+ " i32 constant out of range"
30
+ )
31
+ (assert_malformed
32
+ (module quote " (table 0x1_0000_0000 0x1_0000_0000 funcref)" )
33
+ " i32 constant out of range"
34
+ )
35
+ (assert_malformed
36
+ (module quote " (table 0 0x1_0000_0000 funcref)" )
37
+ " i32 constant out of range"
38
+ )
39
+
40
+
1
41
;; Duplicate table identifiers
2
42
3
43
(assert_malformed (module quote
You can’t perform that action at this time.
0 commit comments