Email me

Rust advisories / rkyv

Unsound MediumRUSTSEC-2026-0122 · rkyv

RUSTSEC-2026-0122: Potential use-after-free due to lack of panic safety in `InlineVec::clear` and `SerVec::clear`

Short answerrkyv has an API that can cause undefined behaviour from safe code: Potential use-after-free due to lack of panic safety in `InlineVec::clear` and `SerVec::clear`. Fixed in 0.8.16.

Craterkyv
TypeUnsound (code-execution, memory-corruption)
Affected versionsFrom 0.8.0 before 0.8.16.
Fixed in0.8.16
SeverityMedium (GitHub rating)
Published2026-04-23
Last changed2026-05-16
Also known asGHSA-vfvv-c25p-m7mm

What to do

  1. See which version you have: cargo tree -i rkyv (it also shows which of your dependencies pulls it in).
  2. Update within your version requirement: cargo update -p rkyv. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for example rkyv = "0.8.16") or update the dependency that pulls it in.
  3. Check again with cargo audit, or paste your Cargo.lock into our Cargo.toml checker.

Details from the advisory

InlineVec::clear() and SerVec::clear() in rkyv were not panic-safe. Both functions iterate over their elements and call drop_in_place on each, updating self.len only *after* the loop. If an element's Drop implementation panics during the loop, self.len is left at its original value.

A subsequent invocation of clear() on the same container then re-visits the already-freed elements:

  • InlineVec::clear() is called again from InlineVec's own Drop implementation when the value is later dropped.
  • SerVec::clear() is called again by SerVec::with_capacity() after the user closure returns.

Impact

  • **CWE-415 (Double Free):** heap corruption when the element type is one that owns memory, such as Box<T> or Vec<T>
  • **CWE-416 (Use-After-Free):** memory corruption when an element is accessed following a caught panic

Both types of undefined behavior can be invoked in safe Rust, but only if unwinding panics are enabled and std::panic::catch_unwind is used.

References

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 rkyv

Full security history of rkyv

Up next

Same craterkyv: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ