Skip to content

Commit 760cdc4

Browse files
committed
[test] Correct tests for missing elements
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: WebAssembly#1170.
1 parent 7526564 commit 760cdc4

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
@@ -773,8 +773,23 @@
773773
"\09\07\02" ;; elem with inconsistent segment count (2 declared, 1 given)
774774
"\00\41\00\0b\01\00" ;; elem 0
775775
;; "\00\41\00\0b\01\00" ;; elem 1 (missed)
776-
"\0a\04\01" ;; code section
777-
"\02\00\0b" ;; function body
776+
)
777+
"unexpected end"
778+
)
779+
780+
;; 2 elem segment declared, 1.5 given
781+
(assert_malformed
782+
(module binary
783+
"\00asm" "\01\00\00\00"
784+
"\01\04\01" ;; type section
785+
"\60\00\00" ;; type 0
786+
"\03\02\01\00" ;; func section
787+
"\04\04\01" ;; table section
788+
"\70\00\01" ;; table 0
789+
"\09\07\02" ;; elem with inconsistent segment count (2 declared, 1 given)
790+
"\00\41\00\0b\01\00" ;; elem 0
791+
"\00\41\00" ;; elem 1 (partial)
792+
;; "\0b\01\00" ;; elem 1 (missing part)
778793
)
779794
"unexpected end"
780795
)

0 commit comments

Comments
 (0)