Skip to content

Commit

Permalink
2024-11-13 15:41:39
Browse files Browse the repository at this point in the history
  • Loading branch information
mohanson committed Nov 13, 2024
1 parent 5e919f3 commit 69f66d2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pywasm/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1665,7 +1665,7 @@ def evaluate(self) -> None:
case pywasm.opcode.memory_grow:
mems = self.store.mems[frame.module.mems[0]]
size = mems.size
incr = self.stack.value.pop().into_i32()
incr = self.stack.value.pop().into_u32()
rets = -1
# Limit memory size to 64m.
cnda = size + incr <= 1024
Expand Down Expand Up @@ -2520,11 +2520,10 @@ def evaluate(self) -> None:
case pywasm.opcode.table_grow:
tabl = self.store.tabl[frame.module.tabl[instr.args[0]]]
size = tabl.size
incr = self.stack.value.pop().into_i32()
incr = self.stack.value.pop().into_u32()
init = self.stack.value.pop()
rets = -1
# Reject growing to size outside i32 value range
cnda = incr >= 0
cnda = size + incr <= 1024
cndb = tabl.type.limits.m == 0 or size + incr <= tabl.type.limits.m
if cnda and cndb:
rets = size
Expand Down

0 comments on commit 69f66d2

Please sign in to comment.