Skip to content

Commit

Permalink
2024-11-13 15:26:12
Browse files Browse the repository at this point in the history
  • Loading branch information
mohanson committed Nov 13, 2024
1 parent b02f1a5 commit 686585f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pywasm/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1457,15 +1457,15 @@ def evaluate_mem_load(self, offset: int, size: int) -> bytearray:
mems = self.store.mems[self.stack.frame[-1].module.mems[0]]
addr = self.stack.value.pop().into_u32()
addr = addr + offset
assert addr >= 0 and addr + size <= len(mems.data)
assert addr + size <= len(mems.data)
return mems.data[addr:addr+size]

def evaluate_mem_save(self, offset: int, size: int) -> bytearray:
mems = self.store.mems[self.stack.frame[-1].module.mems[0]]
data = self.stack.value.pop().data
addr = self.stack.value.pop().into_u32()
addr = addr + offset
assert addr >= 0 and addr + size <= len(mems.data)
assert addr + size <= len(mems.data)
mems.data[addr:addr+size] = data[:size]

def evaluate(self) -> None:
Expand Down Expand Up @@ -1552,7 +1552,7 @@ def evaluate(self) -> None:
case pywasm.opcode.call_indirect:
tabl = self.store.tabl[frame.module.tabl[instr.args[1]]]
type = frame.module.type[instr.args[0]]
addr = tabl.elem[self.stack.value.pop().into_i32()].into_ref()
addr = tabl.elem[self.stack.value.pop().into_u32()].into_ref()
assert self.store.func[addr].type == type
self.evaluate_call(addr)
case pywasm.opcode.drop:
Expand Down

0 comments on commit 686585f

Please sign in to comment.