Rust zstd Streaming Decoder Flaws Can Expose Up to 32 KiB of Heap Memory
Vulnerability Disclosure · 3 sources · Updated 22d ago · First seen Oct 26, 2026

RustSec disclosed related memory-exposure vulnerabilities in the Rust zstd and zstd-safe crates that can expose stale heap data when streaming decompression encounters corrupt legacy Zstandard frames. RUSTSEC-2026-0392 affects zstd versions 0.4.22 through 0.7.x, while RUSTSEC-2026-0403 affects zstd-safe versions from 4.0.0 up to, but excluding, 8.2.0. Through the streaming write decoder, a malformed legacy frame as small as five or six bytes can cause up to 32 KiB of uninitialized heap memory to reach the application's wrapped writer. Legacy support is enabled by default; disclosure to an attacker depends on where the application sends that output.
The flaws stem from incorrect output-buffer length or position handling after decompression fails, potentially extending a Rust vector over memory that was never initialized. The zstd-safe patch restores previous buffer positions on error, with a regression test confirming that failed decompression leaves buffer positions and output length at zero. zstd-safe 8.2.0 fixes the flaw; moving to zstd 0.8.0 alone is insufficient because that release switched to the separately affected zstd-safe buffers. Organizations processing untrusted compressed data should review streaming write-decoder usage and dependency lockfiles and ensure the patched dependency is deployed. The read decoder, zstd::decode_all, and bulk API are unaffected by the zstd-safe advisory.


