-
Notifications
You must be signed in to change notification settings - Fork 107
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
try_transmute_mut
, TryFromBytes::*mut*
soundness issue
#2226
Comments
Ack; thanks for the report. It looks like we're missing a |
Ensures that the source reference remains valid after the transmuted (and possibly mutated) destination is dropped. Fixes #2226
Ensures that the source reference remains valid after the transmuted (and possibly mutated) destination is dropped. Fixes #2226
Ensures that the source reference remains valid after the transmuted (and possibly mutated) destination is dropped. Fixes #2226
Ensures that the source reference remains valid after the transmuted (and possibly mutated) destination is dropped. Makes progress on #2226
Ensures that the source reference remains valid after the transmuted (and possibly mutated) destination is dropped. Makes progress on #2226
Ensures that the source reference remains valid after the transmuted (and possibly mutated) destination is dropped. Makes progress on #2226
#2229, which fixes this issue at a surface level (it's sound, but doesn't fix the underlying internals that allowed this to slip through) is published in 0.8.16. |
try_transmute_mut
soundness issuetry_transmute_mut
, TryTransmuteFrom::*mut*
soundness issue
The underlying issue that led to us not enforce a |
try_transmute_mut
, TryTransmuteFrom::*mut*
soundness issuetry_transmute_mut
, TryFromBytes::*mut*
soundness issue
Ensures that the source reference remains valid after the transmuted (and possibly mutated) destination is dropped. Makes progress on #2226 gherrit-pr-id: I425e7d5103cb3b2a9e7107bf9df0743dca2e08cb
…ryFromBytes::try_mut*` (#2343) * Enforce `Src: FromBytes` in `try_transmute_mut!` (#2229) Ensures that the source reference remains valid after the transmuted (and possibly mutated) destination is dropped. Makes progress on #2226 gherrit-pr-id: I425e7d5103cb3b2a9e7107bf9df0743dca2e08cb * Add `Self: IntoBytes` bound to `TryFromBytes::try_mut*` Consider that `MaybeUninit<u8>` is `TryFromBytes`. If a `&mut [u8]` is cast into a `&mut MaybeUninit<u8>`, then uninit bytes are written, the shadowed `&mut [u8]`'s referent will no longer be valid. Makes progress towards #2226 and #1866. gherrit-pr-id: Ib233c4d0643e0690c53a37a08d9845e5fe43249c --------- Co-authored-by: Jack Wrenn <[email protected]> Co-authored-by: Jack Wrenn <[email protected]>
Progress
Src: FromBytes
bound totry_transmute_mut!
Self: IntoBytes
bound toTryFromBytes::*mut*
MaybeUninit<u8>
isTryFromBytes
, but permits writing uninitialized bytes that would invalidated the shadowedsrc
reference.try_cast_or_pme
sound andTryFromBytes::*mut*
soundPtr
's validity invariant modeling #1866Original text
Using zerocopy 0.8.13:
cargo +nightly miri run
caught an UB:try_transmute_mut may not be a safe API that can be exposed because it only does validation when creating the reference but the user is free to write whatever bit pattern to the created reference.
The text was updated successfully, but these errors were encountered: