Skip to content
Heist/ feed
Back to feed
UnratedFix available

Uninitialized memory exposed when streaming decompression of a legacy frame fails

Type: advisorySources: OSV

When decompression fails inside a legacy (zstd v0.4 to v0.7) frame, the bundled zstd library reports the output buffer as fully written although nothing was written. `DCtx::decompress_stream` committed that position even on error, and for a `Vec` destination this extended the vector's length over uninitialized memory. Legacy support is enabled by default. A 5- or 6-byte corrupt legacy frame is enough: through `zstd::stream::write::Decoder`, up to 32 KiB of stale heap memory is then passed to the wrapped writer on the next `write()` or `flush()`, or when an `auto_flush()`/`on_flush()` decoder is dropped. Whether this reaches an attacker depends on where the application sends the decompressed output. `zstd::stream::read::Decoder`, `zstd::decode_all` and the bulk API are not affected. Before zstd-safe 4.0.0, output buffers could only be initialized slices. The zstd crate's own writer had the same flaw from 0.4.22 to 0.7.x, which is covered by a separate advisory. The flaw was corrected by only committing the buffer positions of a successful call.

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

Uninitialized memory exposed when streaming decompression of a legacy frame fails

core-osv · Original source

Published 16 Oct 2026, 12:00 UTC

When decompression fails inside a legacy (zstd v0.4 to v0.7) frame, the bundled zstd library reports the output buffer as fully written although nothing was written. `DCtx::decompress_stream` committed that position even on error, and for a `Vec` destination this extended the vector's length over uninitialized memory. Legacy support is enabled by default. A 5- or 6-byte corrupt legacy frame is enough: through `zstd::stream::write::Decoder`, up to 32 KiB of stale heap memory is then passed to the wrapped writer on the next `write()` or `flush()`, or when an `auto_flush()`/`on_flush()` decoder is dropped. Whether this reaches an attacker depends on where the application sends the decompressed output. `zstd::stream::read::Decoder`, `zstd::decode_all` and the bulk API are not affected. Before zstd-safe 4.0.0, output buffers could only be initialized slices. The zstd crate's own writer had the same flaw from 0.4.22 to 0.7.x, which is covered by a separate advisory. The flaw was corrected by only committing the buffer positions of a successful call.

osv:RUSTSEC-2026-0403

zstd-safe

Fixed versions: 8.2.0

Complete source record
{
  "id": "12feab03c9d518eebab1f70ef961c2c9399852fba264b207c9a0802fa418a872",
  "url": "https://osv.dev/vulnerability/RUSTSEC-2026-0403",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Uninitialized memory exposed when streaming decompression of a legacy frame fails",
    "summary": "When decompression fails inside a legacy (zstd v0.4 to v0.7) frame, the bundled zstd library reports the output buffer as fully written although nothing was written. `DCtx::decompress_stream` committed that position even on error, and for a `Vec` destination this extended the vector's length over uninitialized memory. Legacy support is enabled by default. A 5- or 6-byte corrupt legacy frame is enough: through `zstd::stream::write::Decoder`, up to 32 KiB of stale heap memory is then passed to the wrapped writer on the next `write()` or `flush()`, or when an `auto_flush()`/`on_flush()` decoder is dropped. Whether this reaches an attacker depends on where the application sends the decompressed output. `zstd::stream::read::Decoder`, `zstd::decode_all` and the bulk API are not affected. Before zstd-safe 4.0.0, output buffers could only be initialized slices. The zstd crate's own writer had the same flaw from 0.4.22 to 0.7.x, which is covered by a separate advisory. The flaw was corrected by only committing the buffer positions of a successful call.",
    "evidence": "osv:RUSTSEC-2026-0403",
    "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-0403",
      "aliases": [
        "RUSTSEC-2026-0403"
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "SEMVER",
              "events": [
                {
                  "introduced": "4.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-0403.json",
            "categories": [
              "memory-exposure"
            ],
            "informational": null
          },
          "ecosystem_specific": {
            "affects": {
              "os": [],
              "arch": [],
              "functions": [
                "zstd_safe::DCtx::decompress_stream"
              ]
            },
            "affected_functions": null
          }
        }
      ],
      "modified": "2026-10-26T14:00:05.787441176Z",
      "provider": "osv",
      "references": [
        "https://crates.io/crates/zstd-safe",
        "https://rustsec.org/advisories/RUSTSEC-2026-0403.html",
        "https://github.com/gyscos/zstd-rs/commit/006e1d1ad1eeaf6b5d4c28329e70217adabcec43",
        "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": 454199,
  "published_at": "2026-10-16T12:00:00+00:00"
}