Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Commit 3957c7d

Browse files
authored
[test] Add cases checking maximum allowed number of locals (#1272)
1 parent 9ff8601 commit 3957c7d

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

test/core/binary.wast

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,24 @@
350350
"zero flag expected"
351351
)
352352

353-
;; No more than 2^32 locals.
353+
;; Local number is unsigned 32 bit
354+
(assert_malformed
355+
(module binary
356+
"\00asm" "\01\00\00\00"
357+
"\01\04\01\60\00\00" ;; Type section
358+
"\03\02\01\00" ;; Function section
359+
"\0a\0c\01" ;; Code section
360+
361+
;; function 0
362+
"\0a\02"
363+
"\80\80\80\80\10\7f" ;; 0x100000000 i32
364+
"\02\7e" ;; 0x00000002 i64
365+
"\0b" ;; end
366+
)
367+
"integer too large"
368+
)
369+
370+
;; No more than 2^32-1 locals.
354371
(assert_malformed
355372
(module binary
356373
"\00asm" "\01\00\00\00"
@@ -367,6 +384,24 @@
367384
"too many locals"
368385
)
369386

387+
(assert_malformed
388+
(module binary
389+
"\00asm" "\01\00\00\00"
390+
"\01\06\01\60\02\7f\7f\00" ;; Type section: (param i32 i32)
391+
"\03\02\01\00" ;; Function section
392+
"\0a\1c\01" ;; Code section
393+
394+
;; function 0
395+
"\1a\04"
396+
"\80\80\80\80\04\7f" ;; 0x40000000 i32
397+
"\80\80\80\80\04\7e" ;; 0x40000000 i64
398+
"\80\80\80\80\04\7d" ;; 0x40000000 f32
399+
"\80\80\80\80\04\7c" ;; 0x40000000 f64
400+
"\0b" ;; end
401+
)
402+
"too many locals"
403+
)
404+
370405
;; Local count can be 0.
371406
(module binary
372407
"\00asm" "\01\00\00\00"

0 commit comments

Comments
 (0)