Email me

Rust advisories / rustc-serialize

Vulnerability MediumRUSTSEC-2022-0004 · rustc-serialize

RUSTSEC-2022-0004: Stack overflow in rustc_serialize when parsing deeply nested JSON

Short answerA security vulnerability in the rustc-serialize crate: Stack overflow in rustc_serialize when parsing deeply nested JSON. GitHub rates it Medium. No fixed version: replace the crate or remove the affected code path.

Craterustc-serialize
TypeVulnerability (denial-of-service)
Affected versionsEvery version.
Fixed innone
SeverityMedium (GitHub rating)
Published2022-01-01
Last changed2023-11-08
Also known asGHSA-2226-4v3c-cff8
Affected functionsrustc_serialize::json::Json::from_str

What to do

  1. Find who pulls it in: cargo tree -i rustc-serialize.
  2. Avoid the affected API (rustc_serialize::json::Json::from_str), or replace the crate.

Details from the advisory

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.

References

From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.

Other advisories for rustc-serialize

Full security history of rustc-serialize

Up next

Same craterustc-serialize: security historyEvery advisory for this crate, and whether it is safe to use today.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ