Skip to content
Heist/ feed
Back to feed
UnratedFix available

Use-after-free of a dictionary after a one-shot call on a context with an open stream

Type: advisorySources: OSV

The one-shot `DCtx` and `CCtx` methods assumed the C library resets the context, but it leaves an open stream as it is. When a stream was left unfinished on a context, a one-shot call such as `decompress_using_dict` could leave the context pointing at the dictionary borrowed for that call, and the next streaming call resumed the stream against it after it was freed: decompressed output then contained freed heap memory. On the compression side, the stream resumed against the one-shot call's buffers. This requires an application to use one context for both streaming and one-shot calls without a reset in between. The flaw was corrected by resetting the session after one-shot calls whenever a stream may be open.

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

Use-after-free of a dictionary after a one-shot call on a context with an open stream

core-osv · Original source

Published 16 Oct 2026, 12:00 UTC

The one-shot `DCtx` and `CCtx` methods assumed the C library resets the context, but it leaves an open stream as it is. When a stream was left unfinished on a context, a one-shot call such as `decompress_using_dict` could leave the context pointing at the dictionary borrowed for that call, and the next streaming call resumed the stream against it after it was freed: decompressed output then contained freed heap memory. On the compression side, the stream resumed against the one-shot call's buffers. This requires an application to use one context for both streaming and one-shot calls without a reset in between. The flaw was corrected by resetting the session after one-shot calls whenever a stream may be open.

osv:RUSTSEC-2026-0400

zstd-safe

Fixed versions: 8.2.0

Complete source record
{
  "id": "f9578a6ab85a6ae601cc864d3ea419bba9798bb58dbfdc793f0854ed97223c84",
  "url": "https://osv.dev/vulnerability/RUSTSEC-2026-0400",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Use-after-free of a dictionary after a one-shot call on a context with an open stream",
    "summary": "The one-shot `DCtx` and `CCtx` methods assumed the C library resets the context, but it leaves an open stream as it is. When a stream was left unfinished on a context, a one-shot call such as `decompress_using_dict` could leave the context pointing at the dictionary borrowed for that call, and the next streaming call resumed the stream against it after it was freed: decompressed output then contained freed heap memory. On the compression side, the stream resumed against the one-shot call's buffers. This requires an application to use one context for both streaming and one-shot calls without a reset in between. The flaw was corrected by resetting the session after one-shot calls whenever a stream may be open.",
    "evidence": "osv:RUSTSEC-2026-0400",
    "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-0400",
      "aliases": [
        "RUSTSEC-2026-0400"
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "SEMVER",
              "events": [
                {
                  "introduced": "3.0.1"
                },
                {
                  "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-0400.json",
            "categories": [
              "memory-exposure"
            ],
            "informational": "unsound"
          },
          "ecosystem_specific": {
            "affects": {
              "os": [],
              "arch": [],
              "functions": [
                "zstd_safe::DCtx::decompress",
                "zstd_safe::DCtx::decompress_using_ddict",
                "zstd_safe::DCtx::decompress_using_dict"
              ]
            },
            "affected_functions": null
          }
        }
      ],
      "modified": "2026-10-26T14:00:05.692077560Z",
      "provider": "osv",
      "references": [
        "https://crates.io/crates/zstd-safe",
        "https://rustsec.org/advisories/RUSTSEC-2026-0400.html",
        "https://github.com/gyscos/zstd-rs/commit/d34502a0ed07f80ab2aa4c65059578e0466f2467",
        "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": 454198,
  "published_at": "2026-10-16T12:00:00+00:00"
}