VDB
Sign up
—

RUSTSEC-2026-0395

Use-after-free with `CParameter::StableInBuffer`

Details

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.

Are you affected?

Enter the version of the package you're using.

Affected packages

crates.io/zstd-safe
Introduced in: 4.1.0Fixed in: 7.4.0

Upgrade zstd-safe to 7.4.0 or newer (ecosystem crates.io).

References