Skip to content

Commit 780479f

Browse files
authored
[test] Correct tests for missing elements (#1251)
Remove the code section in tests for malformed element section. Otherwise the code section id (0x0a) is taken as an element's table index what is a validation error. This is similar to the previously reported issue: #1170.
1 parent eae22f6 commit 780479f

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

test/core/binary.wast

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,8 +787,23 @@
787787
"\09\07\02" ;; elem with inconsistent segment count (2 declared, 1 given)
788788
"\00\41\00\0b\01\00" ;; elem 0
789789
;; "\00\41\00\0b\01\00" ;; elem 1 (missed)
790-
"\0a\04\01" ;; code section
791-
"\02\00\0b" ;; function body
790+
)
791+
"unexpected end"
792+
)
793+
794+
;; 2 elem segment declared, 1.5 given
795+
(assert_malformed
796+
(module binary
797+
"\00asm" "\01\00\00\00"
798+
"\01\04\01" ;; type section
799+
"\60\00\00" ;; type 0
800+
"\03\02\01\00" ;; func section
801+
"\04\04\01" ;; table section
802+
"\70\00\01" ;; table 0
803+
"\09\07\02" ;; elem with inconsistent segment count (2 declared, 1 given)
804+
"\00\41\00\0b\01\00" ;; elem 0
805+
"\00\41\00" ;; elem 1 (partial)
806+
;; "\0b\01\00" ;; elem 1 (missing part)
792807
)
793808
"unexpected end"
794809
)

0 commit comments

Comments
 (0)