Vulnerability CriticalRUSTSEC-2021-0003 · smallvec
RUSTSEC-2021-0003: Buffer overflow in SmallVec::insert_many
Short answerA security vulnerability in the smallvec crate: Buffer overflow in SmallVec::insert_many. Critical severity (CVSS 9.8). Fixed in 0.6.14, 1.6.1: update to a fixed version.
| Crate | smallvec |
|---|---|
| Type | Vulnerability (memory-corruption) |
| Affected versions | From 0.6.3 before 0.6.14; from 1.0.0 before 1.6.1. |
| Fixed in | 0.6.14, 1.6.1 |
| 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-01-08 |
| Last changed | 2026-07-17 |
| Also known as | CVE-2021-25900, GHSA-43w2-9j62-hq99 |
| Affected functions | smallvec::SmallVec::insert_many |
What to do
- See which version you have:
cargo tree -i smallvec(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p smallvec. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for examplesmallvec = "1.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
A bug in the SmallVec::insert_many method caused it to allocate a buffer that was smaller than needed. It then wrote past the end of the buffer, causing a buffer overflow and memory corruption on the heap.
This bug was only triggered if the iterator passed to insert_many yielded more items than the lower bound returned from its size_hint method.
The flaw was corrected in smallvec 0.6.14 and 1.6.1, by ensuring that additional space is always reserved for each item inserted. The fix also simplified the implementation of insert_many to use less unsafe code, so it is easier to verify its correctness.
Thank you to Yechan Bae (@Qwaz) and the Rust group at Georgia Tech’s SSLab for finding and reporting this bug.
References
- Package: crates.io/crates/smallvec
- Advisory: rustsec.org/advisories/RUSTSEC-2021-0003.html
- Report: github.com/servo/rust-smallvec/issues/252
From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.
Other advisories for smallvec
- Vulnerability CriticalRUSTSEC-2018-0003 · 2018-07-19Possible double free during unwinding in SmallVec::insert_many
- UnsoundRUSTSEC-2018-0018 · 2018-09-25smallvec creates uninitialized value of any type
- Vulnerability CriticalRUSTSEC-2019-0009 · 2019-06-06Double-free and use-after-free in SmallVec::grow()
- Vulnerability CriticalRUSTSEC-2019-0012 · 2019-07-19Memory corruption in SmallVec::grow()
Up next
Same cratesmallvec: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →Did this answer your question?