Closed saethlin closed 1 week ago
This program (reduced from an ICE encountered when running the tests for https://crates.io/crates/tinyset):
fn main() { let bytes = isize::MAX as usize + 1; unsafe { let layout = std::alloc::Layout::from_size_align_unchecked(bytes, 1); // Undetected library(?) UB here let _ = std::alloc::alloc_zeroed(layout); } }
Hits this ICE:
thread 'rustc' panicked at src/tools/miri/src/alloc_bytes.rs:71:59: called `Result::unwrap()` on an `Err` value: LayoutError
Caused by this unwrap: https://github.com/rust-lang/miri/blob/60a720040d6c60656ab9cac0980e587d19d9c07a/src/alloc_bytes.rs#L71
That's kind of expected, Miri does not make any attempt to handle OOM or too big allocations. But probably it shouldn't be that unwrap that signals that.
unwrap
This program (reduced from an ICE encountered when running the tests for https://crates.io/crates/tinyset):
Hits this ICE:
Caused by this unwrap: https://github.com/rust-lang/miri/blob/60a720040d6c60656ab9cac0980e587d19d9c07a/src/alloc_bytes.rs#L71