handle overflown in Heap::with_cell_capacity

This commit is contained in:
Skgland
2025-12-07 22:59:00 +01:00
committed by Bennet Bleßmann
parent 11901b5fde
commit 47e908bf76

View File

@@ -599,7 +599,7 @@ impl Heap {
pub(crate) fn with_cell_capacity(cap: usize) -> Result<Self, AllocError> {
let ptr = unsafe {
let layout = alloc::Layout::from_size_align(
cap * size_of::<HeapCellValue>(),
heap_index_checked!(cap).ok_or(AllocError)?,
size_of::<HeapCellValue>(),
)
.unwrap();