{"id":"RUSTSEC-2026-0291","aliases":["RUSTSEC-2026-0291"],"related":[],"kind":"vulnerability","state":"published","title":"Double free in `OwnedAlloc::drop_in_place` when the contained value's `Drop` panics","summary":"`OwnedAlloc::drop_in_place` destroys the contained value by hand, then commits\nthe ownership transfer with `mem::forget(self)` — which lives inside `into_raw`\nand so runs only after the destruction. `T::drop` is user code and may panic. If\nit does, the forget is skipped and the still-live `OwnedAlloc` unwinds, whose\ndestructor drops the same `T` a second time and then deallocates. For a `T` that\nowns an allocation, the same block is freed twice — a double free (CWE-415).\nThat destructor also reads the already-destroyed value through\n`Layout::for_value` before deallocating, a use-after-free (CWE-416).\n\n`MaybeUninitAlloc::drop_in_place` delegates to the same function, so both public\nentry points are affected. Storing a value whose `Drop` can panic and calling\neither is enough — no `unsafe` on the caller's side.\n\n## Fix\n\nNo fixed release is available. The crate has had no release since 2018 and the\nmaintainer has not responded to the report, nor to the one on `lockfree`, which\nis published from the same account. `forget_inner` leaks the value instead of\ndestroying it, which is safe.","summaryFormat":"markdown","summarySource":"rustsec","descriptions":[{"lang":"en","text":"`OwnedAlloc::drop_in_place` destroys the contained value by hand, then commits\nthe ownership transfer with `mem::forget(self)` — which lives inside `into_raw`\nand so runs only after the destruction. `T::drop` is user code and may panic. If\nit does, the forget is skipped and the still-live `OwnedAlloc` unwinds, whose\ndestructor drops the same `T` a second time and then deallocates. For a `T` that\nowns an allocation, the same block is freed twice — a double free (CWE-415).\nThat destructor also reads the already-destroyed value through\n`Layout::for_value` before deallocating, a use-after-free (CWE-416).\n\n`MaybeUninitAlloc::drop_in_place` delegates to the same function, so both public\nentry points are affected. Storing a value whose `Drop` can panic and calling\neither is enough — no `unsafe` on the caller's side.\n\n## Fix\n\nNo fixed release is available. The crate has had no release since 2018 and the\nmaintainer has not responded to the report, nor to the one on `lockfree`, which\nis published from the same account. `forget_inner` leaks the value instead of\ndestroying it, which is safe.","format":"markdown","source":"rustsec"}],"published":"2026-09-09T12:00:00.000Z","modified":"2026-09-21T09:15:02.893Z","severities":[],"cwes":[],"affected":[{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected"}],"ecosystem":"crates.io","package":"owned-alloc","purl":"pkg:cargo/owned-alloc","source":"rustsec"}],"references":[{"url":"https://crates.io/crates/owned-alloc","tags":["package"],"sources":["rustsec"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2026-0291.html","tags":["advisory"],"sources":["rustsec"]},{"url":"https://gitlab.com/bzim/owned-alloc/-/issues/1","tags":["report"],"sources":["rustsec"]}],"credits":[],"sources":[{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2026-0291","url":"https://rustsec.org/advisories/RUSTSEC-2026-0291.html","licence":"CC0-1.0","modified":"2026-09-21T09:15:02.893Z"}],"updatedAt":"2026-11-25T22:56:43.410Z"}