Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(interpreter): avoid overflow when checking if mem limit reached
  • Loading branch information
grandizzy committed May 17, 2024
commit a778a250afb85584ae43f3334246a565d6920526
2 changes: 1 addition & 1 deletion crates/interpreter/src/interpreter/shared_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down