Rust advisories / through
Vulnerability CriticalRUSTSEC-2021-0049 · through
RUSTSEC-2021-0049: `through` and `through_and` causes a double free if the map function panics
Short answerA security vulnerability in the through crate: `through` and `through_and` causes a double free if the map function panics. Critical severity (CVSS 9.8). No fixed version: replace the crate or remove the affected code path.
| Crate | through |
|---|---|
| Type | Vulnerability (memory-corruption) |
| Affected versions | Every version. |
| Fixed in | none |
| Severity | Critical, CVSS 9.8 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| Published | 2021-02-18 |
| Last changed | 2023-11-08 |
| Also known as | CVE-2021-29940, GHSA-5hpj-m323-cphm |
What to do
- Find who pulls it in:
cargo tree -i through. - Avoid the affected API, or replace the crate.
Details from the advisory
through and through_and take a mutable reference as well as a mapping function to change the provided reference. They do this by calling ptr::read on the reference which duplicates ownership and then calling the mapping function.
If the mapping function panics, both the original object and the one duplicated by ptr::read get dropped, causing a double free.
References
- Package: crates.io/crates/through
- Advisory: rustsec.org/advisories/RUSTSEC-2021-0049.html
- Report: github.com/gretchenfrage/through/issues/1
From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.
Up next
Are you affected?Check your whole dependency treePaste Cargo.lock: every advisory, for your exact versions.Read it next →Also worth your time
Did this answer your question?