GHSA-gw5w-5j7f-jmjj: Unsound usages of `std::slice::from_raw_parts`
The library breaks the safety assumptions when using unsafe API std::slice::fromrawparts. First, when using the API in iterator implementation (TempFdArrayIterator.next), generic type could be any type, which would create and pass a misaligned pointer to the unsafe API.
Published Dec 5, 2024
Affected packages
pprof
- Ecosystem
- Rust (crates.io)
- Affected
- < 0.14.0
- Fixed in
- 0.14.0
- Check
cargo tree -i pprof
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
The library breaks the safety assumptions when using unsafe API std::slice::from_raw_parts. First, when using the API in iterator implementation (TempFdArrayIterator.next), generic type could be any type, which would create and pass a misaligned pointer to the unsafe API. Second, when validating the address, the code passed the type c_void, which could also be any type, leading to potential uninitialized memory exposure.
Two unsound usages here highlight the necessity for developers to perform type checks before doing type conversion with unsafe API.
The panic caused by the misalignment causes several downstream applications (e.g., greptimedb) to crash when using pprof::report::ReportBuilder::build.
This was patched in 0.14.0.
The developer also suggested moving to pprof2.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
