The following example currently overflows usize in the calculation of the allocation size, writes into an allocation that is actually zero bytes, and segfaults:
use elsa::sync::*;
fn main() {
let v = LockFreeFrozenVec::<u64>::with_capacity(1<<(64 - 3));
loop { v.push(1); }
}
This changes it to use Layout::array, which checks for overflow.
The following example currently overflows
usize
in the calculation of the allocation size, writes into an allocation that is actually zero bytes, and segfaults:This changes it to use
Layout::array
, which checks for overflow.