Closed
Description
offset_from
currently requires that:
Both the starting and other pointer must be either in bounds or one byte past the end of the same allocated object.
However, Miri fails to check this condition -- the following program should error, but it does not:
fn main() {
let start_ptr = &() as *const ();
let length = 10;
let end_ptr = (start_ptr as *const u8).wrapping_add(length) as *const ();
unsafe { (end_ptr as *const u8).offset_from(start_ptr as *const u8); }
}