Skip to content

Commit d456ed8

Browse files
authored
[test] Test u64 LEB128s that straddle maximum value (#38)
1 parent 44ab5bd commit d456ed8

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

test/core/binary-leb128.wast

+33
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,39 @@
878878
)
879879
"integer too large"
880880
)
881+
(module binary
882+
"\00asm" "\01\00\00\00"
883+
"\01\04\01\60\00\00" ;; Type section
884+
"\03\02\01\00" ;; Function section
885+
"\05\03\01\04\00" ;; Memory section (flags: i64)
886+
"\0a\13\01" ;; Code section
887+
;; function 0
888+
"\11\00" ;; local type count
889+
"\42\00" ;; i64.const 0
890+
"\28" ;; i32.load
891+
"\02" ;; alignment 2
892+
"\ff\ff\ff\ff\ff\ff\ff\ff\ff\01" ;; offset 2^64 - 1
893+
"\1a" ;; drop
894+
"\0b" ;; end
895+
)
896+
(assert_malformed
897+
(module binary
898+
"\00asm" "\01\00\00\00"
899+
"\01\04\01\60\00\00" ;; Type section
900+
"\03\02\01\00" ;; Function section
901+
"\05\03\01\04\00" ;; Memory section (flags: i64)
902+
"\0a\13\01" ;; Code section
903+
;; function 0
904+
"\11\00" ;; local type count
905+
"\42\00" ;; i64.const 0
906+
"\28" ;; i32.load
907+
"\02" ;; alignment 2
908+
"\ff\ff\ff\ff\ff\ff\ff\ff\ff\02" ;; offset 2^64 (one unused bit set)
909+
"\1a" ;; drop
910+
"\0b" ;; end
911+
)
912+
"integer too large"
913+
)
881914

882915
;; Signed LEB128s sign-extend
883916
(assert_malformed

0 commit comments

Comments
 (0)