-
Notifications
You must be signed in to change notification settings - Fork 360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Miri does not catch UB when swap_nonoverlapping
is used on the same ptr
#4188
Comments
Looks like |
I agree with that assessment. @Phoqinu are you interested in fixing this? |
I'll leave that to others 👍 |
Rollup merge of rust-lang#136890 - saethlin:swap_nonoverlapping, r=RalfJung Change swap_nonoverlapping from lang to library UB The implementation of ptr::swap_nonoverlapping does not always escalate its safety contract to language UB, so it should be `check_library_ub`. Fixes rust-lang/miri#4188
Change swap_nonoverlapping from lang to library UB The implementation of ptr::swap_nonoverlapping does not always escalate its safety contract to language UB, so it should be `check_library_ub`. Fixes rust-lang/miri#4188
Change swap_nonoverlapping from lang to library UB The implementation of ptr::swap_nonoverlapping does not always escalate its safety contract to language UB, so it should be `check_library_ub`. Fixes #4188
Hello, I was writing a lot of unsafe in my lib and it passed tests with
cargo miri test
but runningcargo test
crashed with:So I made this example:
One of the
Safety
requirements ofptr::swap_nonoverlapping
isThe region of memory beginning at x with a size of count * size_of::<T>() bytes must not overlap with the region of memory beginning at y with the same size.
but miri does not catch this.While it panics in debug mode without running miri I think miri should catch this... or not ?
The text was updated successfully, but these errors were encountered: