zstd-safe heap buffer overflow in CCtx::try_clone

Severity: info · Published 2026-10-16

zstd-safe is a Rust library that provides bindings to the Zstandard compression algorithm. A heap buffer overflow flaw in the CCtx::try_clone function can allow an attacker to write or read up to 512 KiB past a heap allocation when using multithreaded compression, potentially leading to memory corruption or information disclosure.

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

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=4.1.4,fixed=8.2.0; Zstd-Rs Zstd-Safe 4.1.4 through 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 Zstd-Rs 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 exists in CCtx::try_clone (an experimental, deprecated function) which copies internal tables based on context parameters. When a multithreaded compression frame (zstdmt) is started, it replaces those parameters with worker values without resizing the context's tables. After an abandoned single-threaded frame, the try_clone operation writes or reads up to 512 KiB past the heap allocation boundary. The flaw requires a Rust application to explicitly call try_clone and use both single-threaded and multithreaded compression modes on the same context.

Affected products

  • zstd-rs zstd-safe 4.1.4 through 8.1.x

Timeline

  • 2026-10-16: disclosed
  • 2026-10-26: patched

References

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