Ref swap: UB can be reached from safe code
Affects ref-swapSource GCVE Database
Rated High by Threat Radar's AI analysis
- Patch
- Available – fixed in 0.1.3
Data as of 13 Nov 2026, 13:17 UTC
What to do
Upgrade ref-swap to 0.1.3.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
crates.ioref-swappkg:cargo/ref-swapOther threats | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
Upgrade to ref-swap version 0.1.3 or later to apply the official fix. If your project compiles with version 0.1.3, it is not affected by this unsoundness. No other mitigation is required.
Description
The ref-swap crate versions prior to 0.1.3 contain incorrect variance definitions for RefSwap and OptionRefSwap, which may lead to use-after-free vulnerabilities. Additionally, OptionRefSwap::into_inner did not properly check for null values. These issues were addressed by making RefSwap and OptionRefSwap invariant and modifying OptionRefSwap::into_inner to return an option. Projects compiling with version 0.1.3 or later are not affected.