{"id":"GHSA-2226-4v3c-cff8","aliases":["GHSA-2226-4v3c-cff8","RUSTSEC-2022-0004"],"related":[],"kind":"vulnerability","state":"published","title":"Stack overflow in rustc_serialize when parsing deeply nested JSON","summary":"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.\n\nExample code that triggers the vulnerability is\n\n```rust\nfn main() {\n    let _ = rustc_serialize::json::Json::from_str(&\"[0,[\".repeat(10000));\n}\n```\n\n[serde](https://crates.io/crates/serde) is recommended as a replacement to rustc_serialize.","summaryFormat":"markdown","summarySource":"ghsa","descriptions":[{"lang":"en","text":"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.\n\nExample code that triggers the vulnerability is\n\n```rust\nfn main() {\n    let _ = rustc_serialize::json::Json::from_str(&\"[0,[\".repeat(10000));\n}\n```\n\n[serde](https://crates.io/crates/serde) is recommended as a replacement to rustc_serialize.","format":"markdown","source":"ghsa"}],"published":"2022-01-01T12:00:00.000Z","modified":"2023-11-08T04:13:48.926Z","severity":{"scorer":"GitHub","scheme":"rating","rating":"MEDIUM"},"severities":[{"scorer":"GitHub","scheme":"rating","rating":"MEDIUM"}],"cwes":[],"affected":[{"ranges":[{"type":"semver","introduced":"0","status":"affected","lastAffected":"0.3.24"}],"ecosystem":"crates.io","package":"rustc-serialize","purl":"pkg:cargo/rustc-serialize","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.0.0-0","status":"affected"}],"ecosystem":"crates.io","package":"rustc-serialize","purl":"pkg:cargo/rustc-serialize","source":"rustsec"}],"references":[{"url":"https://github.com/rust-lang-deprecated/rustc-serialize","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/rust-lang/rustc-serialize","tags":["package"],"sources":["ghsa"]},{"url":"https://rustsec.org/advisories/RUSTSEC-2022-0004.html","tags":["advisory","web"],"sources":["ghsa","rustsec"]},{"url":"https://crates.io/crates/rustc-serialize","tags":["package"],"sources":["rustsec"]}],"credits":[],"sources":[{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-2226-4v3c-cff8","url":"https://github.com/advisories/GHSA-2226-4v3c-cff8","licence":"CC-BY-4.0","modified":"2023-11-08T04:13:48.926Z"},{"source":"rustsec","name":"RustSec Advisory Database","id":"RUSTSEC-2022-0004","url":"https://rustsec.org/advisories/RUSTSEC-2022-0004.html","licence":"CC0-1.0","modified":"2023-11-08T04:13:48.926Z"}],"updatedAt":"2026-11-25T22:56:43.089Z"}