GHSA-2226-4v3c-cff8
medium
Stack overflow in rustc_serialize when parsing deeply nested JSON
- Severity
- medium rating by GitHub
- Published
- Last changed
- Also known as
- RUSTSEC-2022-0004
Description
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| rustc-serialize (crates.io) | up to 0.3.24, from 0.0.0-0 | GitHub Advisory Database, RustSec Advisory Database |
References
Sources
| Source | Record | Licence |
|---|---|---|
| GitHub Advisory Database | GHSA-2226-4v3c-cff8 changed 2023-11-08 | CC-BY-4.0 |
| RustSec Advisory Database | RUSTSEC-2022-0004 changed 2023-11-08 | CC0-1.0 |