RUSTSEC-2022-0004 on 2022-01-01: Stack 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.

GHSA-2226-4v3c-cff8

This review is from Crev, a distributed system for code reviews. To add your review, set up cargo-crev.

The current version of rustc-serialize is 0.3.25.

0.3.24 (older version) Rating: Neutral + Unmaintained Thoroughness: None Understanding: None

by kornelski on 2020-05-12


These reviews are from cargo-vet. To add your review, set up cargo-vet and submit your URL to its registry.

The current version of rustc-serialize is 0.3.25.

cargo-vet does not verify reviewers' identity. You have to fully trust the source the audits are from.

safe-to-run

This crate can be compiled, run, and tested on a local workstation or in controlled automation without surprising consequences. More…

unknown

May have been packaged automatically without a review


Crates in the crates.io registry are tarball snapshots uploaded by crates' publishers. The registry is not using crates' git repositories. There is absolutely no guarantee that the repository URL declared by the crate belongs to the crate, or that the code in the repository is the code inside the published tarball. To review the actual code of the crate, it's best to use cargo crev open rustc-serialize. Alternatively, you can download the tarball of rustc-serialize v0.3.25 or view the source online.