Headline
GHSA-48m6-wm5p-rr6h: Insufficient covariance check makes self_cell unsound
All public versions prior to 1.02
used an insufficient check to ensure that users correctly marked the dependent type as either covariant
or not_covariant
. This allowed users to mark a dependent as covariant even though its type was not covariant but invariant, for certain invariant types involving trait object lifetimes. One example for such a dependent type is type Dependent<'a> = RefCell<Box<dyn fmt::Display + 'a>>
. Such a type allowed unsound usage in purely safe user code that leads to undefined behavior. The patched versions now produce a compile time error if such a type is marked as covariant
.
Skip to content
Actions
Automate any workflow
Packages
Host and manage packages
Security
Find and fix vulnerabilities
Codespaces
Instant dev environments
Copilot
Write better code with AI
Code review
Manage code changes
Issues
Plan and track work
Discussions
Collaborate outside of code
GitHub Sponsors
Fund open source developers
* The ReadME Project
GitHub community articles
- Pricing
- GitHub Advisory Database
- GitHub Reviewed
- GHSA-48m6-wm5p-rr6h
Insufficient covariance check makes self_cell unsound
High severity GitHub Reviewed Published Nov 14, 2023 to the GitHub Advisory Database • Updated Nov 14, 2023
Package
cargo self_cell (Rust)
Affected versions
< 0.10.3
>= 1.0.0, < 1.0.2
Patched versions
0.10.3
1.0.2
Description
All public versions prior to 1.02 used an insufficient check to ensure that users correctly marked the dependent type as either covariant or not_covariant. This allowed users to mark a dependent as covariant even though its type was not covariant but invariant, for certain invariant types involving trait object lifetimes. One example for such a dependent type is type Dependent<’a> = RefCell<Box<dyn fmt::Display + 'a>>. Such a type allowed unsound usage in purely safe user code that leads to undefined behavior. The patched versions now produce a compile time error if such a type is marked as covariant.
References
- Voultapher/self_cell#49
- https://rustsec.org/advisories/RUSTSEC-2023-0070.html
Published to the GitHub Advisory Database
Nov 14, 2023
Last updated
Nov 14, 2023