Skip to main content
← All vulnerabilities
RUSTSEC-2026-0401

Out-of-bounds read in `train_from_buffer` when sample sizes overflow

Published
Last modified
published
Not listed in CISA KEV
Fix
Fixed in 8.2.0
None on Exploit-DB, Metasploit or GitHub

Summary

The affected software is the Rust `zstd` crate's dictionary training feature (`zstd::dict::from_continuous`), which uses the zstd dictionary trainer. A flaw in how sample sizes are summed can let an attacker-influenced input cause the trainer to read past the end of a buffer, but only when those sample sizes come from an untrusted source.

Summarized by anthropic/claude-haiku-5.5. Verify details against the original sources.

Read the original description

`ZDICT_trainFromBuffer` is never told the length of the samples buffer, so `train_from_buffer` checked that the sample sizes add up to it. With overflow checks off, as in release builds, that sum wrapped around: sizes totalling 2^64 plus the buffer length passed the check, and the trainer read past the end of the buffer. `zstd::dict::from_continuous` relies on this check from zstd 0.4.10; older versions of zstd had their own, covered by a separate advisory. This requires the sample sizes to come from an untrusted source. The flaw was corrected by summing the sizes with overflow checks.

Timeline

  1. Advisory published
  2. Record last updated

Affected versions

  • zstd-safecrates.io

    From 0.0.0-0 · fixed in 8.2.0

References 4

crates.io

rustsec.org

GitHub · gyscos/zstd-rs