Rust advisories / mimalloc
Unsound MediumRUSTSEC-2022-0094 · mimalloc
RUSTSEC-2022-0094: Mimalloc Can Allocate Memory with Bad Alignment
Short answermimalloc has an API that can cause undefined behaviour from safe code: Mimalloc Can Allocate Memory with Bad Alignment. Fixed in 0.1.39.
| Crate | mimalloc |
|---|---|
| Type | Unsound |
| Affected versions | Before 0.1.39. |
| Fixed in | 0.1.39 |
| Severity | Medium (GitHub rating) |
| Published | 2022-11-23 |
| Last changed | 2025-10-28 |
| Also known as | GHSA-g23h-7vf9-xc25 |
What to do
- See which version you have:
cargo tree -i mimalloc(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p mimalloc. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for examplemimalloc = "0.1.39") 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
This crate depended on a promise regarding alignments made by the author of the mimalloc allocator to avoid using aligned allocation functions where possible for performance reasons. Since then, the mimalloc allocator's logic changed, making it break this promise. This caused this crate to return memory with an incorrect alignment for some allocations, particularly those with large alignments. The flaw was fixed by always using the aligned allocation functions.
References
- Package: crates.io/crates/mimalloc
- Advisory: rustsec.org/advisories/RUSTSEC-2022-0094.html
- Report: github.com/purpleprotocol/mimalloc_rust/issues/87
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?