Skip to content

Commit acaaf8a

Browse files
authored
[test] Invalid memory / table import types (#1264)
1 parent eae5e77 commit acaaf8a

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/core/imports.wast

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,13 @@
384384
(table 10 funcref)
385385
(table 10 funcref)
386386
)
387+
;; Can't test values above 2^32 because wast parsing will reject them
388+
(assert_invalid
389+
(module
390+
(import "" "" (table 1 0 funcref))
391+
)
392+
"size minimum must not be greater than maximum"
393+
)
387394

388395
(module (import "test" "table-10-inf" (table 10 funcref)))
389396
(module (import "test" "table-10-inf" (table 5 funcref)))
@@ -496,6 +503,30 @@
496503
(module (memory 0) (memory 0))
497504
"multiple memories"
498505
)
506+
(assert_invalid
507+
(module
508+
(import "" "" (memory 65537 65538))
509+
)
510+
"memory size must be at most 65536 pages"
511+
)
512+
(assert_invalid
513+
(module
514+
(import "" "" (memory 0 65537))
515+
)
516+
"memory size must be at most 65536 pages"
517+
)
518+
(assert_invalid
519+
(module
520+
(import "" "" (memory 1 0))
521+
)
522+
"size minimum must not be greater than maximum"
523+
)
524+
(assert_invalid
525+
(module
526+
(import "" "" (memory 65537))
527+
)
528+
"memory size must be at most 65536 pages"
529+
)
499530

500531
(module (import "test" "memory-2-inf" (memory 2)))
501532
(module (import "test" "memory-2-inf" (memory 1)))

0 commit comments

Comments
 (0)