handle overflown in Heap::with_cell_capacity
This commit is contained in:
@@ -599,7 +599,7 @@ impl Heap {
|
|||||||
pub(crate) fn with_cell_capacity(cap: usize) -> Result<Self, AllocError> {
|
pub(crate) fn with_cell_capacity(cap: usize) -> Result<Self, AllocError> {
|
||||||
let ptr = unsafe {
|
let ptr = unsafe {
|
||||||
let layout = alloc::Layout::from_size_align(
|
let layout = alloc::Layout::from_size_align(
|
||||||
cap * size_of::<HeapCellValue>(),
|
heap_index_checked!(cap).ok_or(AllocError)?,
|
||||||
size_of::<HeapCellValue>(),
|
size_of::<HeapCellValue>(),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user