Vulnerability CriticalRUSTSEC-2021-0070 · nalgebra
RUSTSEC-2021-0070: VecStorage Deserialize Allows Violation of Length Invariant
Short answerA security vulnerability in the nalgebra crate: VecStorage Deserialize Allows Violation of Length Invariant. GitHub rates it Critical. Fixed in 0.27.1: update to a fixed version.
| Crate | nalgebra |
|---|---|
| Type | Vulnerability (memory-corruption, memory-exposure) |
| Affected versions | From 0.11.0 before 0.27.1. |
| Fixed in | 0.27.1 |
| Severity | Critical (GitHub rating) |
| Published | 2021-06-06 |
| Last changed | 2023-11-08 |
| Also known as | CVE-2021-38190, GHSA-3w8g-xr3f-2mp8 |
What to do
- See which version you have:
cargo tree -i nalgebra(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p nalgebra. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for examplenalgebra = "0.27.1") 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 Deserialize implementation for VecStorage did not maintain the invariant that the number of elements must equal nrows * ncols. Deserialization of specially crafted inputs could allow memory access beyond allocation of the vector.
This flaw was introduced in v0.11.0 (086e6e) due to the addition of an automatically derived implementation of Deserialize for MatrixVec. MatrixVec was later renamed to VecStorage in v0.16.13 (0f66403) and continued to use the automatically derived implementation of Deserialize.
This flaw was corrected in commit 5bff536 by returning an error during deserialization if the number of elements does not exactly match the expected size.
References
- Package: crates.io/crates/nalgebra
- Advisory: rustsec.org/advisories/RUSTSEC-2021-0070.html
- Report: github.com/dimforge/nalgebra/issues/883
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
Same cratenalgebra: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →Did this answer your question?