GHSA-2226-4v3c-cff8
JSON

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 packageVersionsReported by
rustc-serialize (crates.io)up to 0.3.24, from 0.0.0-0GitHub Advisory Database, RustSec Advisory Database

References

Sources

SourceRecordLicence
GitHub Advisory DatabaseGHSA-2226-4v3c-cff8 changed 2023-11-08CC-BY-4.0
RustSec Advisory DatabaseRUSTSEC-2022-0004 changed 2023-11-08CC0-1.0