Security mailing lists by PureSourceCode

RUSTSEC-2022-0004

MEDIUM

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.

Published
1 Jan 2022
Last modified
8 Nov 2023
Also known as
GHSA-2226-4v3c-cff8
Sources
OSV GHSA-2226-4v3c-cff8JSONOSVJSON

Affected

SourceVendor / ecosystemProduct / packageAffected versionsFixed in
OSV crates.io rustc-serialize <= 0.3.24
OSV crates.io rustc-serialize >= 0.0.0-0

References

History

  • 25 Nov 2026 20:14 UTC · OSV: first stored (published 1 Jan 2022)
  • 25 Nov 2026 20:14 UTC · OSV: first stored (published 17 Jun 2022)
An unhandled error has occurred. Reload ×

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.