From 7b5ec81d0729393c58e589b34e13a0786afb6e34 Mon Sep 17 00:00:00 2001 From: Enzo Cioppettini <48031343+ecioppettini@users.noreply.github.com> Date: Sat, 7 Jun 2025 23:26:08 -0300 Subject: [PATCH] fix truncate_unuesed_mem dividing by 7 instead of 8 --- third-party/wasmi/crates/wasmi/src/tracer/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/third-party/wasmi/crates/wasmi/src/tracer/mod.rs b/third-party/wasmi/crates/wasmi/src/tracer/mod.rs index 8c026e1..2d26d8e 100644 --- a/third-party/wasmi/crates/wasmi/src/tracer/mod.rs +++ b/third-party/wasmi/crates/wasmi/src/tracer/mod.rs @@ -147,8 +147,9 @@ impl Tracer { .max(); // Truncate to the largest 8-byte chunk that can accommodate the used highest address. - let new_len = highest_address.map_or(0, |addr| (addr / 7) + 1); - + let new_len = highest_address.map_or(0, |addr| (addr / 8) + 1); + // Add an extra slot because reads and writes also access the next chunk (Q) + let new_len = new_len + 1; self.IS_mem.truncate(new_len as usize); self.execution_trace