From 47e908bf76851c0afd018b30ee8d2ed53fe53316 Mon Sep 17 00:00:00 2001 From: Skgland Date: Sun, 7 Dec 2025 22:59:00 +0100 Subject: [PATCH] handle overflown in Heap::with_cell_capacity --- src/machine/heap.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/machine/heap.rs b/src/machine/heap.rs index 3d614ebb..c93d005b 100644 --- a/src/machine/heap.rs +++ b/src/machine/heap.rs @@ -599,7 +599,7 @@ impl Heap { pub(crate) fn with_cell_capacity(cap: usize) -> Result { let ptr = unsafe { let layout = alloc::Layout::from_size_align( - cap * size_of::(), + heap_index_checked!(cap).ok_or(AllocError)?, size_of::(), ) .unwrap(); -- 2.54.0