RUSTSEC-2022-0004
MEDIUMStack overflow in rustc_serialize when parsing deeply nested JSON
When parsing JSON using json::Json::from_str, there is no limit to the depth of the stack, therefore deeply nested objects can cause a stack overflow, which aborts the process.
Example code that triggers the vulnerability is
fn main() {
let _ = rustc_serialize::json::Json::from_str(&"[0,[".repeat(10000));
}
serde is recommended as a replacement to rustc_serialize.
- Published
- 1 Jan 2022
- Last modified
- 8 Nov 2023
- Also known as
- GHSA-2226-4v3c-cff8
- Sources
- OSV GHSA-2226-4v3c-cff8JSONOSVJSON
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| OSV | crates.io | rustc-serialize | <= 0.3.24 | |
| OSV | crates.io | rustc-serialize | >= 0.0.0-0 |
References
- https://github.com/rust-lang-deprecated/rustc-serialize · WEB
- https://github.com/rust-lang/rustc-serialize · PACKAGE
- https://rustsec.org/advisories/RUSTSEC-2022-0004.html · WEB, ADVISORY
- https://crates.io/crates/rustc-serialize · PACKAGE
History
- 25 Nov 2026 20:14 UTC · OSV: first stored (published 1 Jan 2022)
- 25 Nov 2026 20:14 UTC · OSV: first stored (published 17 Jun 2022)