-
Notifications
You must be signed in to change notification settings - Fork 390
Closed
rust-lang/rust
#94827Labels
A-shimsArea: This affects the external function shimsArea: This affects the external function shimsC-bugCategory: This is a bug.Category: This is a bug.I-misses-UBImpact: makes Miri miss UB, i.e., a false negative (with default settings)Impact: makes Miri miss UB, i.e., a false negative (with default settings)
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); }
}
Metadata
Metadata
Assignees
Labels
A-shimsArea: This affects the external function shimsArea: This affects the external function shimsC-bugCategory: This is a bug.Category: This is a bug.I-misses-UBImpact: makes Miri miss UB, i.e., a false negative (with default settings)Impact: makes Miri miss UB, i.e., a false negative (with default settings)