Rust advisories / circular-buffer
UnsoundRUSTSEC-2026-0256 · circular-buffer
RUSTSEC-2026-0256: Panic-safety unsoundness in `truncate_back`, `truncate_front`, `clear`, and `extend_from_slice` (use-after-free / double-free)
Short answercircular-buffer has an API that can cause undefined behaviour from safe code: Panic-safety unsoundness in `truncate_back`, `truncate_front`, `clear`, and `extend_from_slice` (use-after-free / double-free). Fixed in 2.0.1.
| Crate | circular-buffer |
|---|---|
| Type | Unsound (memory-corruption) |
| Affected versions | Before 2.0.1. |
| Fixed in | 2.0.1 |
| Severity | not scored |
| Published | 2026-08-11 |
| Last changed | 2026-08-12 |
| Also known as | none |
| Affected functions | circular_buffer::CircularBuffer::clear, circular_buffer::CircularBuffer::extend_from_slice, circular_buffer::CircularBuffer::truncate_back, circular_buffer::CircularBuffer::truncate_front |
What to do
- See which version you have:
cargo tree -i circular-buffer(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p circular-buffer. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for examplecircular-buffer = "2.0.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
Several methods in circular-buffer drop elements before updating the buffer's start/end metadata. If an element's Drop panics during the drop, the metadata update is skipped, so the buffer still treats the already-dropped elements as live. When the buffer is later dropped (or used after the panic is caught), those elements are visited again , a use-after-free / double-free reachable from safe Rust.
Impact
- **CWE-415 (Double Free):** the same allocation is freed twice.
- **CWE-416 (Use-After-Free):** a freed allocation is accessed during a repeated
Drop.
Reachable entirely from safe Rust via catch_unwind with element types whose Drop can panic.
Fix
Fixed in circular-buffer 2.0.1 by adjusting the buffer's start/end metadata before the elements are dropped.
References
- Package: crates.io/crates/circular-buffer
- Advisory: rustsec.org/advisories/RUSTSEC-2026-0256.html
- Web: github.com/andreacorbellini/rust-circular-buffer/blob/master/CHANGELOG.md
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?