Unsound HighRUSTSEC-2020-0145 · heapless
RUSTSEC-2020-0145: Use-after-free when cloning a partially consumed `Vec` iterator
Short answerheapless has an API that can cause undefined behaviour from safe code: Use-after-free when cloning a partially consumed `Vec` iterator. Fixed in 0.6.1.
| Crate | heapless |
|---|---|
| Type | Unsound (memory-corruption, memory-exposure) |
| Affected versions | Before 0.6.1. |
| Fixed in | 0.6.1 |
| Severity | High, CVSS 7.5 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| Published | 2020-11-02 |
| Last changed | 2023-11-08 |
| Also known as | CVE-2020-36464, GHSA-qgwf-r2jj-2ccv |
| Affected functions | heapless::vec::IntoIter::clone |
What to do
- See which version you have:
cargo tree -i heapless(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p heapless. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for exampleheapless = "0.6.1") or update the dependency that pulls it in. - Check again with
cargo audit, or paste your Cargo.lock into our Cargo.toml checker.
Details from the advisory
The IntoIter Clone implementation clones the whole underlying Vec. If the iterator is partially consumed the consumed items will be copied, thus creating a use-after-free access.
A proof of concept is available in the original bug report.
References
- Package: crates.io/crates/heapless
- Advisory: rustsec.org/advisories/RUSTSEC-2020-0145.html
- Report: github.com/japaric/heapless/issues/181
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
Same crateheapless: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →Did this answer your question?