Rust advisories / lzf
Unsound MediumRUSTSEC-2022-0067 · lzf
RUSTSEC-2022-0067: Invalid use of `mem::uninitialized` causes `use-of-uninitialized-value`
Short answerlzf has an API that can cause undefined behaviour from safe code: Invalid use of `mem::uninitialized` causes `use-of-uninitialized-value`. Fixed in 0.3.2.
| Crate | lzf |
|---|---|
| Type | Unsound |
| Affected versions | Before 0.3.2. |
| Fixed in | 0.3.2 |
| Severity | Medium (GitHub rating) |
| Published | 2022-10-22 |
| Last changed | 2023-11-08 |
| Also known as | GHSA-5m39-wx2q-mxg3 |
| Affected functions | lzf::compress, lzf::decompress |
What to do
- See which version you have:
cargo tree -i lzf(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p lzf. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for examplelzf = "0.3.2") or update the dependency that pulls it in. - Check again with
cargo audit, or paste your Cargo.lock into our Cargo.toml checker.
Details from the advisory
The compression and decompression function used mem:uninitialized to create an array of uninitialized values, to later write values into it. This later leads to reads from uninitialized memory.
The flaw was corrected in commit b633bf265e41c60dfce3be7eac4e4dd5e18d06cf by using a heap-allocated Vec and removing out use of mem::uninitialized. The fix was released in v0.3.2 and v1.0.0
Subsequently the crate was deprecated and its use is discouraged.
References
- Package: crates.io/crates/lzf
- Advisory: rustsec.org/advisories/RUSTSEC-2022-0067.html
- Report: github.com/badboy/lzf-rs/issues/9
From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.
Up next
Are you affected?Check your whole dependency treePaste Cargo.lock: every advisory, for your exact versions.Read it next →Also worth your time
Did this answer your question?