Advisory Database
  • Advisories
  • Dependency Scanning
  1. cargo
  2. ›
  3. bumpalo
  4. ›
  5. GHSA-f85w-wvc7-crwc

GHSA-f85w-wvc7-crwc: bumpalo has use-after-free due to a lifetime error in `Vec::into_iter()`

January 20, 2023

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.

The following example demonstrates memory corruption arising from a misuse of this unsoundness.

use bumpalo::{collections::Vec, Bump};

fn main() {
let bump = Bump::new();
let mut vec = Vec::new_in(&bump);
vec.extend([0x01u8; 32]);
let into_iter = vec.into_iter();
drop(bump);

for _ in 0..100 {
let reuse_bump = Bump::new();
let _reuse_alloc = reuse_bump.alloc([0x41u8; 10]);
}

for x in into_iter {
print!("0x{:02x} ", x);
}
println!();
}

The 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.

References

  • github.com/advisories/GHSA-f85w-wvc7-crwc
  • github.com/fitzgen/bumpalo
  • github.com/fitzgen/bumpalo/blob/main/CHANGELOG.md
  • rustsec.org/advisories/RUSTSEC-2022-0078.html

Code Behaviors & Features

Detect and mitigate GHSA-f85w-wvc7-crwc with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions starting from 1.1.0 before 3.11.1

Fixed versions

  • 3.11.1

Solution

Upgrade to version 3.11.1 or above.

Source file

cargo/bumpalo/GHSA-f85w-wvc7-crwc.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:14:48 +0000.