diff --git a/crates/interpreter/src/interpreter/shared_memory.rs b/crates/interpreter/src/interpreter/shared_memory.rs index e76015a58c..cc63e1bf07 100644 --- a/crates/interpreter/src/interpreter/shared_memory.rs +++ b/crates/interpreter/src/interpreter/shared_memory.rs @@ -90,7 +90,7 @@ impl SharedMemory { #[cfg(feature = "memory_limit")] #[inline] pub fn limit_reached(&self, new_size: usize) -> bool { - (self.last_checkpoint + new_size) as u64 > self.memory_limit + self.last_checkpoint.saturating_add(new_size) as u64 > self.memory_limit } /// Prepares the shared memory for a new context.