{"id":"GHSA-vfvv-c25p-m7mm","summary":"rkyv: Panic safety bugs in `InlineVec::clear` and `SerVec::clear` enable arbitrary code execution","details":"`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.\n\nA subsequent invocation of `clear()` on the same container then re-visits the already-freed elements:\n\n- `InlineVec::clear()` is called again from `InlineVec`'s own `Drop` implementation when the value is later dropped.\n- `SerVec::clear()` is called again by `SerVec::with_capacity()` after the  user closure returns.\n\n\n## Technical Impact\n\n- **CWE-415 (Double Free):** Heap corruption when element type holds `Box\u003cT\u003e`  \n- **CWE-416 (Use-After-Free):** Memory corruption when element reads from heap during `Drop`\n\nBoth vulnerabilities are triggerable entirely from safe Rust via `std::panic::catch_unwind` and require no special privileges.","aliases":["RUSTSEC-2026-0122"],"modified":"2026-09-10T03:50:47.714144241Z","published":"2026-05-15T18:09:10Z","database_specific":{"github_reviewed_at":"2026-05-15T18:09:10Z","nvd_published_at":null,"cwe_ids":["CWE-415","CWE-416"],"severity":"MODERATE","github_reviewed":true},"references":[{"type":"WEB","url":"https://github.com/rkyv/rkyv/commit/5828cf5c27b664eb4432c4a93d4769e12e5e42fb"},{"type":"PACKAGE","url":"https://github.com/rkyv/rkyv"},{"type":"WEB","url":"https://rustsec.org/advisories/RUSTSEC-2026-0122.html"}],"affected":[{"package":{"name":"rkyv","ecosystem":"crates.io","purl":"pkg:cargo/rkyv"},"ranges":[{"type":"SEMVER","events":[{"introduced":"0.8.0"},{"fixed":"0.8.16"}]}],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/05/GHSA-vfvv-c25p-m7mm/GHSA-vfvv-c25p-m7mm.json"}}],"schema_version":"1.9.0","severity":[{"type":"CVSS_V4","score":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N"}]}