Executive brief
rkyv is a high-performance data serialization library for the Rust programming language. A flaw in how the library handles memory cleanup during errors could allow an attacker to cause a program crash or potentially execute unauthorized code. This occurs when the library attempts to clear data from memory but fails to properly track which items have already been deleted, leading to memory corruption.
Technical details
The `InlineVec::clear` and `SerVec::clear` functions in rkyv are not panic-safe. These functions iterate through elements and call `drop_in_place` on each, but only update the internal length counter after the loop completes. If an element's `Drop` implementation panics, the length remains at its original value. This leads to a double-free or use-after-free scenario when the container is dropped or cleared again, as the already-dropped elements are processed a second time. The vulnerability is triggerable from safe Rust using `std::panic::catch_unwind` and was fixed in version 0.8.16 by updating the length before dropping elements.
Affected products
- rkyv rkyv >= 0.8.0, < 0.8.16
Timeline
- 2026-04-23: other: Reported
- 2026-05-11: advisory: RustSec advisory issued
- 2026-05-15: patched: Version 0.8.16 released and GHSA published