zstd out-of-bounds read in dictionary training from inconsistent samples

Severity: info · Published 2026-10-16

The zstd Rust library, used for data compression, contains a memory safety flaw in its dictionary training function that can read memory beyond allocated buffers. When training a compression dictionary with untrusted sample size values, an attacker could trigger an out-of-bounds read, potentially exposing sensitive data from adjacent memory regions or causing an application crash.

Technologies: zstd (crates.io). Vendors: crates.io.

Quick answers

Is This vulnerability exploited in the wild?
No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.
How severe is This vulnerability?
Informational severity, published 16 October 2026.
Which products and versions are affected?
zstd (crates.io) 0.1.1 to 0.4.9, SEMVER:introduced=0.1.1,fixed=0.4.10.
Is there a fix for This vulnerability?
Yes. zstd (crates.io): upgrade to 0.4.10 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is This vulnerability attacked?
It is attacked over the network, in a software library.
Am I affected?
Check whether you run zstd (crates.io) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • zstd (crates.io): upgrade to 0.4.10 or later
    cargo update -p zstd

Technical details

The vulnerability exists in zstd::dict::from_continuous (formerly train_dict), which passes sample sizes to ZDICT_trainFromBuffer without validating them against the actual buffer length. In versions 0.1.1 to 0.3.x, samples are unchecked; in 0.3.0+, integer overflow in arithmetic wraps around when overflow checks are disabled (typical in release builds). If untrusted sample sizes are provided, the trainer reads past the buffer boundary. The fix in 0.4.10 delegates to zstd-safe 8.2.0, which properly validates buffer boundaries.

Affected products

  • crates.io zstd 0.1.1 to 0.4.9

Timeline

  • 2026-10-16: disclosed
  • 2026-10-26: patched

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.