Skip to content
Heist/ feed
Back to feed
UnratedFix available

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

Type: advisorySources: OSV

`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.

Products
zstd-safe
Affected versions
Not specified
Fixed versions
8.2.0
CVEs
Not specified
Confirmed fixed CVEs
Not specified
Updated in this feed
1 Nov 2026, 14:47 UTC · Revision 1

Source evidence

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

core-osv · Original source

Published 16 Oct 2026, 12:00 UTC

`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.

osv:RUSTSEC-2026-0401

zstd-safe

Fixed versions: 8.2.0

Complete source record
{
  "id": "a790449e5adf98a71f43f91e46f486fd1d71e611cb146435ccaf3691eed70b67",
  "url": "https://osv.dev/vulnerability/RUSTSEC-2026-0401",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Out-of-bounds read in `train_from_buffer` when sample sizes overflow",
    "summary": "`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.",
    "evidence": "osv:RUSTSEC-2026-0401",
    "products": [
      {
        "name": {
          "value": "zstd-safe",
          "evidence": "/affected/0/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "8.2.0",
            "evidence": "/affected/0/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "unknown",
    "structured": {
      "id": "RUSTSEC-2026-0401",
      "aliases": [
        "RUSTSEC-2026-0401"
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "SEMVER",
              "events": [
                {
                  "introduced": "0.0.0-0"
                },
                {
                  "fixed": "8.2.0"
                }
              ]
            }
          ],
          "package": {
            "name": "zstd-safe",
            "purl": "pkg:cargo/zstd-safe",
            "ecosystem": "crates.io"
          },
          "database_specific": {
            "cvss": null,
            "source": "https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2026-0401.json",
            "categories": [
              "memory-exposure"
            ],
            "informational": "unsound"
          },
          "ecosystem_specific": {
            "affects": {
              "os": [],
              "arch": [],
              "functions": [
                "zstd_safe::train_from_buffer"
              ]
            },
            "affected_functions": null
          }
        }
      ],
      "modified": "2026-10-26T14:00:04.231502512Z",
      "provider": "osv",
      "references": [
        "https://crates.io/crates/zstd-safe",
        "https://rustsec.org/advisories/RUSTSEC-2026-0401.html",
        "https://github.com/gyscos/zstd-rs/commit/781ea454191dbf178d09c1daf6fc896d15fbaa2f",
        "https://github.com/gyscos/zstd-rs/pull/384"
      ],
      "provider_metadata": {
        "license": "CC0-1.0"
      }
    },
    "related_cves": [],
    "security_relevant": true,
    "severity_evidence": null
  },
  "source_id": "core-osv",
  "document_id": 454181,
  "published_at": "2026-10-16T12:00:00+00:00"
}