Skip to content
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

Implement more complete fix for #716 #758

Closed
Tracked by #671
joshlf opened this issue Dec 28, 2023 · 0 comments · Fixed by #966
Closed
Tracked by #671

Implement more complete fix for #716 #758

joshlf opened this issue Dec 28, 2023 · 0 comments · Fixed by #966
Labels
compatibility-breaking Changes that are (likely to be) breaking

Comments

@joshlf
Copy link
Member

joshlf commented Dec 28, 2023

The fix implemented for #716 patches the soundness hole, but results in an API which doesn't properly express the type bounds for when it is sound to call Ref::into_ref, into_mut, into_slice, and into_mut_slice. We should restructure the API so that these methods fail to compile when used with unsound types (core::cell::Ref and core::cell::RefMut), but compile successfully when used with sound types. This will be a breaking change.

@joshlf joshlf added the compatibility-breaking Changes that are (likely to be) breaking label Dec 28, 2023
joshlf added a commit that referenced this issue Feb 29, 2024
Add `IntoByteSlice` and `IntoByteSliceMut` traits, which extend
`ByteSlice` and `ByteSliceMut`, adding `Into<&[u8]>` and `Into<&mut
[u8]>` bounds respectively. Use these new traits as the bounds in the
`Ref` methods `into_ref`, `into_mut`, `into_slice`, and
`into_mut_slice`. This allows us to remove the post-monomorphization
error which was originally added to patch the soundness hole in #716 in
a backwards-compatible way.

Closes #758
joshlf added a commit that referenced this issue Feb 29, 2024
Add `IntoByteSlice` and `IntoByteSliceMut` traits, which extend
`ByteSlice` and `ByteSliceMut`, adding `Into<&[u8]>` and `Into<&mut
[u8]>` bounds respectively. Use these new traits as the bounds in the
`Ref` methods `into_ref`, `into_mut`, `into_slice`, and
`into_mut_slice`. This allows us to remove the post-monomorphization
error which was originally added to patch the soundness hole in #716 in
a backwards-compatible way.

Closes #758
github-merge-queue bot pushed a commit that referenced this issue Feb 29, 2024
Add `IntoByteSlice` and `IntoByteSliceMut` traits, which extend
`ByteSlice` and `ByteSliceMut`, adding `Into<&[u8]>` and `Into<&mut
[u8]>` bounds respectively. Use these new traits as the bounds in the
`Ref` methods `into_ref`, `into_mut`, `into_slice`, and
`into_mut_slice`. This allows us to remove the post-monomorphization
error which was originally added to patch the soundness hole in #716 in
a backwards-compatible way.

Closes #758
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility-breaking Changes that are (likely to be) breaking
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant