Skip to main content
VulnerabilityPublished Updated

Ref swap: UB can be reached from safe code

Affects ref-swapSource GCVE Database

0
Severity
High

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

ProductAffectedFixed in
crates.ioref-swappkg:cargo/ref-swapOther threatsAffected
  • >=0.0.0-0 <0.1.3
Fixed in
  • 0.1.3

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.

References

Community reviews

Loading reviews…