Uninitialized memory exposed by `write::Decoder` on a corrupt legacy frame
From 0.4.22 to 0.7.x, the writer behind `zstd::stream::write::Decoder` set its output buffer's length to its full capacity before each decompression call, then to the position the call reported, and only checked for an error afterwards. When decompression fails inside a legacy (zstd v0.4 to v0.7) frame, the bundled zstd library reports the output as fully written although nothing was written, so stale heap memory, up to the buffer size (32 KiB by default), was passed to the wrapped writer. Legacy support is enabled by default, and a few bytes of corrupt legacy frame are enough. Whether this reaches an attacker depends on where the application sends the decompressed output. From 0.8.0, the writer uses zstd-safe's buffers, and the same flaw there is covered by the zstd-safe advisory for it, fixed in zstd-safe 8.2.0.
- Products
- zstd
- Affected versions
- Not specified
- Fixed versions
- 0.8.0
- CVEs
- Not specified
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 1 Nov 2026, 14:47 UTC · Revision 1
Source evidence
Uninitialized memory exposed by `write::Decoder` on a corrupt legacy frame
core-osv · Original sourcePublished 16 Oct 2026, 12:00 UTC
From 0.4.22 to 0.7.x, the writer behind `zstd::stream::write::Decoder` set its output buffer's length to its full capacity before each decompression call, then to the position the call reported, and only checked for an error afterwards. When decompression fails inside a legacy (zstd v0.4 to v0.7) frame, the bundled zstd library reports the output as fully written although nothing was written, so stale heap memory, up to the buffer size (32 KiB by default), was passed to the wrapped writer. Legacy support is enabled by default, and a few bytes of corrupt legacy frame are enough. Whether this reaches an attacker depends on where the application sends the decompressed output. From 0.8.0, the writer uses zstd-safe's buffers, and the same flaw there is covered by the zstd-safe advisory for it, fixed in zstd-safe 8.2.0.
osv:RUSTSEC-2026-0392
zstd
Fixed versions: 0.8.0
Complete source record
{
"id": "94d9e6d882092e51b7999e3bb50a803a54c1ea79a30244a4b4a194dc1165e3bf",
"url": "https://osv.dev/vulnerability/RUSTSEC-2026-0392",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "Uninitialized memory exposed by `write::Decoder` on a corrupt legacy frame",
"summary": "From 0.4.22 to 0.7.x, the writer behind `zstd::stream::write::Decoder` set its output buffer's length to its full capacity before each decompression call, then to the position the call reported, and only checked for an error afterwards. When decompression fails inside a legacy (zstd v0.4 to v0.7) frame, the bundled zstd library reports the output as fully written although nothing was written, so stale heap memory, up to the buffer size (32 KiB by default), was passed to the wrapped writer. Legacy support is enabled by default, and a few bytes of corrupt legacy frame are enough. Whether this reaches an attacker depends on where the application sends the decompressed output. From 0.8.0, the writer uses zstd-safe's buffers, and the same flaw there is covered by the zstd-safe advisory for it, fixed in zstd-safe 8.2.0.",
"evidence": "osv:RUSTSEC-2026-0392",
"products": [
{
"name": {
"value": "zstd",
"evidence": "/affected/0/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "0.8.0",
"evidence": "/affected/0/ranges"
}
],
"affected_versions": []
}
],
"severity": "unknown",
"structured": {
"id": "RUSTSEC-2026-0392",
"aliases": [
"RUSTSEC-2026-0392"
],
"affected": [
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "0.4.22"
},
{
"fixed": "0.8.0"
}
]
}
],
"package": {
"name": "zstd",
"purl": "pkg:cargo/zstd",
"ecosystem": "crates.io"
},
"database_specific": {
"cvss": null,
"source": "https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2026-0392.json",
"categories": [
"memory-exposure"
],
"informational": null
},
"ecosystem_specific": {
"affects": {
"os": [],
"arch": [],
"functions": []
},
"affected_functions": null
}
}
],
"modified": "2026-10-26T14:00:05.805080316Z",
"provider": "osv",
"references": [
"https://crates.io/crates/zstd",
"https://rustsec.org/advisories/RUSTSEC-2026-0392.html",
"https://github.com/gyscos/zstd-rs/commit/006e1d1ad1eeaf6b5d4c28329e70217adabcec43",
"https://github.com/gyscos/zstd-rs/pull/384"
],
"provider_metadata": {
"license": "CC0-1.0"
}
},
"related_cves": [],
"security_relevant": true,
"severity_evidence": null
},
"source_id": "core-osv",
"document_id": 454204,
"published_at": "2026-10-16T12:00:00+00:00"
}