# RUSTSEC-2026-0395: Use-after-free with `CParameter::StableInBuffer`

- Severity: not scored yet
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2026-10-16T12:00:00.000Z
- Modified: 2026-11-02T09:30:03.420Z

## Description

With `CParameter::StableInBuffer(true)` (`experimental` feature), the C
library keeps a pointer to the input of one streaming call and reads from it
in later calls, including `flush_stream` and `end_stream`, which take no
input. An `InBuffer` only borrows its slice for one call, so safe code could
free it in between, and freed memory was compressed into the frame. The C
library behaves this way since zstd 1.5.4, whether bundled or linked from the
system.

The flaw was corrected by refusing to enable the parameter.

(As written by RustSec Advisory Database.)

## Affected

- zstd-safe (crates.io): from 4.1.0 before 7.4.0; from 8.0.0-0 before 8.2.0

## References

- <https://crates.io/crates/zstd-safe> (package)
- <https://rustsec.org/advisories/RUSTSEC-2026-0395.html> (advisory)
- <https://github.com/gyscos/zstd-rs/commit/53a8a290d8cfb52ff5b29fb6e04a40b5a174cc65> (web)
- <https://github.com/gyscos/zstd-rs/pull/384> (web)

## Sources

- RustSec Advisory Database: [RUSTSEC-2026-0395](https://rustsec.org/advisories/RUSTSEC-2026-0395.html), CC0-1.0, modified 2026-11-02

---

Page: https://cve.day/RUSTSEC-2026-0395 · Whole record: https://cve.day/RUSTSEC-2026-0395.json · Rebuilt by cve.day 2026-11-25T22:56:43.450Z
