medium
`temporary` makes use of uninitialized memory
- Severity
- medium rating by GitHub
- Published
- Last changed
- Also known as
- RUSTSEC-2018-0022
Description
Uninitialized memory is used as a RNG seed in temporary. This has been resolved in the 0.6.4 release. The crate is not intended to be used outside of a testing environment. For a general purpose crate to create temporary directories, tempfile is an alternative for this crate.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| temporary (crates.io) | from 0.3.0 before 0.6.4 | GitHub Advisory Database, RustSec Advisory Database |
What each source says
GitHub Advisory Database
Uninitialized memory is used as a RNG seed in temporary. This has been resolved in the 0.6.4 release. The crate is not intended to be used outside of a testing environment. For a general purpose crate to create temporary directories, tempfile is an alternative for this crate.
RustSec Advisory Database
Uninit memory is used as a RNG seed in temporary
The following function is used as a way to get entropy from the system, which does operations on and exposes uninit memory, which is UB.
fn random_seed(_: &Path, _: &str) -> [u64; 2] {
use std::mem::uninitialized as rand;
unsafe { [rand::<u64>() ^ 0x12345678, rand::<u64>() ^ 0x87654321] }
}
This has been resolved in the 0.6.4 release.
The crate is not intended to be used outside of a testing environment.
For a general purpose crate to create temporary directories, tempfile is an alternative for this crate.
References
Sources
| Source | Record | Licence |
|---|---|---|
| GitHub Advisory Database | GHSA-2jq9-6xx7-3h29 changed 2023-11-08 | CC-BY-4.0 |
| RustSec Advisory Database | RUSTSEC-2018-0022 changed 2023-11-08 | CC0-1.0 |