summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2024-01-24 12:21:29 -0800
committerGitHub <noreply@github.com>2024-01-24 12:21:29 -0800
commit6453fd55a312779c2f0d9451d325646522a85470 (patch)
tree3a987b5e05dc726c2e845fc5ea54b256f0427155 /test
parent1ce851d7a2044cd1c121bec7de676a61aa147c79 (diff)
downloadbinaryen-6453fd55a312779c2f0d9451d325646522a85470.tar.gz
binaryen-6453fd55a312779c2f0d9451d325646522a85470.tar.bz2
binaryen-6453fd55a312779c2f0d9451d325646522a85470.zip
Memory flattening: Check for overflow (#6233)
Fixes a fuzz testcase for wasm-ctor-eval. Add the beginnings of a polyfill for stdckdint.h to help that.
Diffstat (limited to 'test')
-rw-r--r--test/lit/ctor-eval/flatten_overflow.wast16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/lit/ctor-eval/flatten_overflow.wast b/test/lit/ctor-eval/flatten_overflow.wast
new file mode 100644
index 000000000..c5044e666
--- /dev/null
+++ b/test/lit/ctor-eval/flatten_overflow.wast
@@ -0,0 +1,16 @@
+;; The data segment here is at an offset too large to fit into the memory due
+;; to an overflow. That will cause us to fail during flatten, so there are no
+;; changes to output here, but we should not error (if we don't check for
+;; overflow, we'd segfault).
+
+;; RUN: wasm-ctor-eval %s --ctors=test --kept-exports=test --quiet -all
+
+(module
+ (memory $0 10 10)
+ (data $0 (i32.const -1) "a")
+
+ (export "test" (func $test))
+
+ (func $test
+ )
+)