Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/wasm-interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -5151,7 +5151,8 @@ class ModuleRunnerBase : public ExpressionRunner<SubType> {
Address
getFinalAddress(LS* curr, Literal ptr, Index bytes, Address memorySize) {
Address memorySizeBytes = memorySize * Memory::kPageSize;
uint64_t addr = ptr.type == Type::i32 ? ptr.geti32() : ptr.geti64();
uint64_t addr = ptr.type == Type::i32 ? (uint64_t)(uint32_t)ptr.geti32()
: (uint64_t)ptr.geti64();
trapIfGt(curr->offset, memorySizeBytes, "offset > memory");
trapIfGt(addr, memorySizeBytes - curr->offset, "final > memory");
addr += curr->offset;
Expand All @@ -5167,7 +5168,8 @@ class ModuleRunnerBase : public ExpressionRunner<SubType> {

Address
getFinalAddressWithoutOffset(Literal ptr, Index bytes, Address memorySize) {
uint64_t addr = ptr.type == Type::i32 ? ptr.geti32() : ptr.geti64();
uint64_t addr = ptr.type == Type::i32 ? (uint64_t)(uint32_t)ptr.geti32()
: (uint64_t)ptr.geti64();
checkLoadAddress(addr, bytes, memorySize);
return addr;
}
Expand Down
4 changes: 2 additions & 2 deletions test/lit/exec/simd-load-lane-oob.wast
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
(global $g (mut i32) (i32.const 0))

;; CHECK: [fuzz-exec] calling oob
;; CHECK-NEXT: [trap final > memory: 18446744073709551615 > 65536]
;; CHECK-NEXT: [trap final > memory: 4294967295 > 65536]
(func $oob (export "oob")
(drop
;; This should trap, but not until after setting the global.
Expand All @@ -34,7 +34,7 @@
)
)
;; CHECK: [fuzz-exec] calling oob
;; CHECK-NEXT: [trap final > memory: 18446744073709551615 > 65536]
;; CHECK-NEXT: [trap final > memory: 4294967295 > 65536]

;; CHECK: [fuzz-exec] calling get
;; CHECK-NEXT: [fuzz-exec] note result: get => 1
Expand Down
8 changes: 4 additions & 4 deletions test/passes/fuzz-exec_O.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[fuzz-exec] calling func_0
[trap final > memory: 18446744073709551615 > 65514]
[trap final > memory: 4294967295 > 65514]
[fuzz-exec] calling func_1
[trap final > memory: 18446744073709551615 > 65514]
[trap final > memory: 4294967295 > 65514]
(module
(type $0 (func (result i64)))
(type $1 (func (result i32)))
Expand All @@ -25,9 +25,9 @@
)
)
[fuzz-exec] calling func_0
[trap final > memory: 18446744073709551615 > 65514]
[trap final > memory: 4294967295 > 65514]
[fuzz-exec] calling func_1
[trap final > memory: 18446744073709551615 > 65514]
[trap final > memory: 4294967295 > 65514]
[fuzz-exec] comparing func_0
[fuzz-exec] comparing func_1
[fuzz-exec] calling div
Expand Down
4 changes: 2 additions & 2 deletions test/passes/fuzz-exec_all-features.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
[fuzz-exec] calling wrap_cmpxchg
[LoggingExternalInterface logging 42]
[fuzz-exec] calling oob_notify
[trap final > memory: 18446744073709551512 > 65514]
[trap final > memory: 4294967192 > 65514]
(module
(type $0 (func (result i32)))
(type $1 (func (param i32)))
Expand Down Expand Up @@ -137,7 +137,7 @@
[fuzz-exec] calling wrap_cmpxchg
[LoggingExternalInterface logging 42]
[fuzz-exec] calling oob_notify
[trap final > memory: 18446744073709551512 > 65514]
[trap final > memory: 4294967192 > 65514]
[fuzz-exec] comparing aligned_for_size
[fuzz-exec] comparing oob_notify
[fuzz-exec] comparing unaligned_load
Expand Down
Loading