summaryrefslogtreecommitdiff
path: root/test/lit/exec
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2024-05-21 16:13:15 -0700
committerGitHub <noreply@github.com>2024-05-21 16:13:15 -0700
commit772e57234c3cba9bdc6432d42017f7c22b3f6e56 (patch)
tree0541b0e405c2555edd732e247ca80bb37bea4305 /test/lit/exec
parent326bfcd7d9f6927e28d106a6cd6e9c408a0f6a0d (diff)
downloadbinaryen-772e57234c3cba9bdc6432d42017f7c22b3f6e56.tar.gz
binaryen-772e57234c3cba9bdc6432d42017f7c22b3f6e56.tar.bz2
binaryen-772e57234c3cba9bdc6432d42017f7c22b3f6e56.zip
Fix TableFill bounds checking (#6621)
The offsets are unsigned.
Diffstat (limited to 'test/lit/exec')
-rw-r--r--test/lit/exec/table.fill.wast32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/lit/exec/table.fill.wast b/test/lit/exec/table.fill.wast
new file mode 100644
index 000000000..b2f092bc4
--- /dev/null
+++ b/test/lit/exec/table.fill.wast
@@ -0,0 +1,32 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py --output=fuzz-exec and should not be edited.
+
+;; RUN: wasm-opt %s -all --fuzz-exec-before -q -o /dev/null 2>&1 | filecheck %s
+
+(module
+ (type $i32 (func (result i32)))
+
+ (table $table 32 32 funcref)
+
+ (func $i32 (type $i32) (result i32)
+ (i32.const 0)
+ )
+
+ ;; CHECK: [fuzz-exec] calling fill
+ ;; CHECK-NEXT: [trap out of bounds table access]
+ (func $fill (export "fill")
+ ;; This fill is out of bounds as the -1 is unsigned. Nothing will be written.
+ (table.fill $table
+ (i32.const 1)
+ (ref.func $i32)
+ (i32.const -1)
+ )
+ )
+ ;; CHECK: [fuzz-exec] calling call
+ ;; CHECK-NEXT: [trap uninitialized table element]
+ (func $call (export "call") (result i32)
+ ;; Nothing was written, so this traps.
+ (call_indirect $table (type $i32)
+ (i32.const 1)
+ )
+ )
+)