zstd-safe use-after-free in dict initialization

Severity: info · Published 2026-10-16

zstd-safe is a Rust library for data compression using the Zstandard algorithm. A use-after-free vulnerability in the dictionary initialization functions could allow an attacker or buggy code to read or write memory after it has been freed, potentially leading to data corruption or code execution. The flaw affects code using the deprecated experimental dictionary API.

Technologies: zstd-safe (crates.io), Gyscos Zstd-Safe. Vendors: crates.io, Gyscos.

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-safe (crates.io) SEMVER:introduced=3.0.0,fixed=8.2.0; Gyscos Zstd-Safe 3.0.0 to 8.1.x.
Is there a fix for This vulnerability?
Yes. zstd-safe (crates.io): upgrade to 8.2.0 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 with local access, in a software library.
Am I affected?
Check whether you run zstd-safe (crates.io) or Gyscos Zstd-Safe 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-safe (crates.io): upgrade to 8.2.0 or later
    cargo update -p zstd-safe

Technical details

The vulnerability is a use-after-free in `CCtx::init_using_cdict` and `DCtx::init_using_ddict` due to incorrect Rust lifetime bounds (only `'b: 'a` instead of requiring the dictionary reference to live as long as the context). This allows a dictionary to be dropped while the context still holds a reference to it. The affected functions are in the deprecated experimental API; no special preconditions are needed beyond calling these functions with a short-lived dictionary.

Affected products

  • gyscos zstd-safe 3.0.0 to 8.1.x

Timeline

  • 2026-10-16: disclosed
  • 2026-10-26: advisory
  • 2026-10-26: patched: Fixed in version 8.2.0

References

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