diff --git a/libs/bump_allocator/src/lib.rs b/libs/bump_allocator/src/lib.rs index 3868aecb..90ffe374 100644 --- a/libs/bump_allocator/src/lib.rs +++ b/libs/bump_allocator/src/lib.rs @@ -35,7 +35,7 @@ impl BumpAllocator { /// Allocates a block of memory with the given size and alignment. fn allocate(&mut self, size: usize, align: usize) -> Option<*mut u8> { let alloc_start = align_up(self.next, align); - let alloc_end = alloc_start + size; + let alloc_end = alloc_start.saturating_add(size); if alloc_end <= self.heap_start + self.heap_size { self.next = alloc_end;