Skip to content

Commit 4be37cf

Browse files
committed
Make ResizeMemory do a full unsigned remainder to check for page size divisibility.
1 parent 2f55ecd commit 4be37cf

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

ml-proto/TestingTodo.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Linear memory semantics:
4949
- test loading "uninitialized" things from aliased stack frames return what's there
5050
- test that loadwithoffset traps in overflow cases
5151
- test that newly allocated memory is zeroed
52+
- test that resize_memory does a full 32-bit unsigned check for page_size divisibility
5253

5354
Function pointer semantics:
5455
- test that function pointers work [correctly](https://github.com/WebAssembly/design/issues/89)

ml-proto/src/spec/eval.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ let rec eval_expr (c : config) (e : expr) =
222222

223223
| ResizeMemory e ->
224224
let i = int32 (eval_expr c e) e.at in
225-
if (Int32.rem i (page_size c)) <> Int32.zero then
225+
if (I32.rem_u i (page_size c)) <> I32.zero then
226226
error e.at "runtime: resize_memory operand not multiple of page_size";
227227
Memory.resize c.modul.memory (Int32.to_int i);
228228
None

0 commit comments

Comments
 (0)