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

zerocopy: Some Ref methods are unsound with some type params #1837

Merged
merged 3 commits into from
Dec 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions crates/zerocopy/RUSTSEC-0000-0000.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
```toml
[advisory]
id = "RUSTSEC-0000-0000"
package = "zerocopy"
date = "2023-12-14"
url = "https://github.com/google/zerocopy/issues/716"
keywords = ["ref", "refcell", "mutable-aliasing"]

[versions]
patched = [">= 0.2.9, < 0.3.0", ">= 0.3.2, < 0.4.0", ">= 0.4.1, < 0.5.0", ">= 0.5.2, < 0.6.0", ">= 0.6.6, < 0.7.0", ">= 0.7.31"]
unaffected = ["< 0.2.2"]

[affected.functions]
"zerocopy::Ref::into_ref" = [">= 0.2.2, < 0.2.9", ">= 0.3.0, < 0.3.2", ">= 0.4.0, < 0.4.1", ">= 0.5.0, < 0.5.2", ">= 0.6.0, < 0.6.6", ">= 0.7.0, < 0.7.31"]
"zerocopy::Ref::into_mut" = [">= 0.2.2, < 0.2.9", ">= 0.3.0, < 0.3.2", ">= 0.4.0, < 0.4.1", ">= 0.5.0, < 0.5.2", ">= 0.6.0, < 0.6.6", ">= 0.7.0, < 0.7.31"]
"zerocopy::Ref::into_slice" = [">= 0.2.2, < 0.2.9", ">= 0.3.0, < 0.3.2", ">= 0.4.0, < 0.4.1", ">= 0.5.0, < 0.5.2", ">= 0.6.0, < 0.6.6", ">= 0.7.0, < 0.7.31"]
"zerocopy::Ref::into_mut_slice" = [">= 0.2.2, < 0.2.9", ">= 0.3.0, < 0.3.2", ">= 0.4.0, < 0.4.1", ">= 0.5.0, < 0.5.2", ">= 0.6.0, < 0.6.6", ">= 0.7.0, < 0.7.31"]
```

# Some Ref methods are unsound with some type parameters

The `Ref` methods `into_ref`, `into_mut`, `into_slice`, and `into_slice_mut` are unsound
and may allow safe code to exhibit undefined behavior when used with `Ref<B, T>` where `B`
is [`cell::Ref`](https://doc.rust-lang.org/core/cell/struct.Ref.html) or
[`cell::RefMut`](https://doc.rust-lang.org/core/cell/struct.RefMut.html). Note that these
methods remain sound when used with `B` types other than `cell::Ref` or `cell::RefMut`.

See https://github.com/google/zerocopy/issues/716 for a more in-depth analysis.

The current plan is to yank the affected versions soon. See
https://github.com/google/zerocopy/issues/679 for more detail.