{"id":"GHSA-f85w-wvc7-crwc","aliases":["GHSA-f85w-wvc7-crwc","RUSTSEC-2022-0078"],"related":[],"kind":"vulnerability","state":"published","title":"bumpalo has use-after-free due to a lifetime error in `Vec::into_iter()`","summary":"In affected versions of this crate, the lifetime of the iterator produced by `Vec::into_iter()` is not constrained to the lifetime of the `Bump` that allocated the vector's memory. Using the iterator after the `Bump` is dropped causes use-after-free accesses.\n\nThe following example demonstrates memory corruption arising from a misuse of this unsoundness.\n\n```rust\nuse bumpalo::{collections::Vec, Bump};\n\nfn main() {\n    let bump = Bump::new();\n    let mut vec = Vec::new_in(&bump);\n    vec.extend([0x01u8; 32]);\n    let into_iter = vec.into_iter();\n    drop(bump);\n\n    for _ in 0..100 {\n        let reuse_bump = Bump::new();\n        let _reuse_alloc = reuse_bump.alloc([0x41u8; 10]);\n    }\n\n    for x in into_iter {\n        print!(\"0x{:02x} \", x);\n    }\n    println!();\n}\n```\n\nThe issue was corrected in version 3.11.1 by adding a lifetime to the `IntoIter` type, and updating the signature of `Vec::into_iter()` to constrain this lifetime.","summaryFormat":"markdown","summarySource":"ghsa","descriptions":[{"lang":"en","text":"In affected versions of this crate, the lifetime of the iterator produced by `Vec::into_iter()` is not constrained to the lifetime of the `Bump` that allocated the vector's memory. Using the iterator after the `Bump` is dropped causes use-after-free accesses.\n\nThe following example demonstrates memory corruption arising from a misuse of this unsoundness.\n\n```rust\nuse bumpalo::{collections::Vec, Bump};\n\nfn main() {\n    let bump = Bump::new();\n    let mut vec = Vec::new_in(&bump);\n    vec.extend([0x01u8; 32]);\n    let into_iter = vec.into_iter();\n    drop(bump);\n\n    for _ in 0..100 {\n        let reuse_bump = Bump::new();\n        let _reuse_alloc = reuse_bump.alloc([0x41u8; 10]);\n    }\n\n    for x in into_iter {\n        print!(\"0x{:02x} \", x);\n    }\n    println!();\n}\n```\n\nThe issue was corrected in version 3.11.1 by adding a lifetime to the `IntoIter` type, and updating the signature of `Vec::into_iter()` to constrain this lifetime.","format":"markdown","source":"ghsa"}],"published":"2022-01-14T12:00:00.000Z","modified":"2026-09-10T03:49:51.242Z","severity":{"scorer":"GitHub","scheme":"rating","rating":"MEDIUM"},"severities":[{"scorer":"GitHub","scheme":"rating","rating":"MEDIUM"}],"cwes":[],"affected":[{"ranges":[{"type":"semver","introduced":"1.1.0","status":"affected","fixed":"3.11.1"}],"ecosystem":"crates.io","package":"bumpalo","purl":"pkg:cargo/bumpalo","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"1.1.0","status":"affected","fixed":"3.11.1"}],"ecosystem":"crates.io","package":"bumpalo","purl":"pkg:cargo/bumpalo","source":"rustsec"}],"references":[{"url":"https://github.com/fitzgen/bumpalo","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/fitzgen/bumpalo/blob/main/CHANGELOG.md#3111","tags":["web"],"sources":["ghsa","rustsec"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2022-0078.html","tags":["advisory","web"],"sources":["ghsa","rustsec"]},{"url":"https://crates.io/crates/bumpalo","tags":["package"],"sources":["rustsec"]}],"credits":[],"sources":[{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-f85w-wvc7-crwc","url":"https://github.com/advisories/GHSA-f85w-wvc7-crwc","licence":"CC-BY-4.0","modified":"2026-09-10T03:49:51.242Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2022-0078","url":"https://rustsec.org/advisories/RUSTSEC-2022-0078.html","licence":"CC0-1.0","modified":"2023-11-08T04:18:53.654Z"}],"updatedAt":"2026-11-25T22:56:43.120Z"}