18d7394071
At least these are the cases I can think of right now.
7 lines
290 B
Rust
7 lines
290 B
Rust
fn main() {
|
|
let b = Box::new(0);
|
|
let x = (&*b as *const i32).wrapping_sub(0x800); // out-of-bounds
|
|
// We cannot compare this with NULL. After all, this *could* be NULL (with the right base address).
|
|
assert!(x != std::ptr::null()); //~ ERROR invalid arithmetic on pointers
|
|
}
|