`Seekable::decompress` sets a `Vec` length beyond its capacity for offsets past the end
`ZSTD_seekable_decompress` shortens the requested length to the end of the data without checking that the offset is before it. For an offset past the end, it returns a wrapped-around length without writing anything, and `Seekable::decompress` passed that length to `Vec::set_len`. With the `seekable` feature, whoever supplies the archive, or chooses the offset, can leave the caller's `Vec` with a length far beyond its capacity. Reading it then discloses neighbouring heap memory, and appending to it corrupts memory. Offsets near `u64::MAX` can also hang the call. The flaw was corrected by clamping requests to the end of the data, and by checking every count reported by the C library against the buffer capacity.
- Products
- zstd-safe
- Affected versions
- Not specified
- Fixed versions
- 8.2.0
- CVEs
- Not specified
- Confirmed fixed CVEs
- Not specified
- Updated in this feed
- 1 Nov 2026, 14:47 UTC · Revision 1
Source evidence
`Seekable::decompress` sets a `Vec` length beyond its capacity for offsets past the end
core-osv · Original sourcePublished 16 Oct 2026, 12:00 UTC
`ZSTD_seekable_decompress` shortens the requested length to the end of the data without checking that the offset is before it. For an offset past the end, it returns a wrapped-around length without writing anything, and `Seekable::decompress` passed that length to `Vec::set_len`. With the `seekable` feature, whoever supplies the archive, or chooses the offset, can leave the caller's `Vec` with a length far beyond its capacity. Reading it then discloses neighbouring heap memory, and appending to it corrupts memory. Offsets near `u64::MAX` can also hang the call. The flaw was corrected by clamping requests to the end of the data, and by checking every count reported by the C library against the buffer capacity.
osv:RUSTSEC-2026-0398
zstd-safe
Fixed versions: 8.2.0
Complete source record
{
"id": "49d6b01fe7c533f0e7833f76580bfa6754ad57ef52ab59ea114b17164251a3e2",
"url": "https://osv.dev/vulnerability/RUSTSEC-2026-0398",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "`Seekable::decompress` sets a `Vec` length beyond its capacity for offsets past the end",
"summary": "`ZSTD_seekable_decompress` shortens the requested length to the end of the data without checking that the offset is before it. For an offset past the end, it returns a wrapped-around length without writing anything, and `Seekable::decompress` passed that length to `Vec::set_len`. With the `seekable` feature, whoever supplies the archive, or chooses the offset, can leave the caller's `Vec` with a length far beyond its capacity. Reading it then discloses neighbouring heap memory, and appending to it corrupts memory. Offsets near `u64::MAX` can also hang the call. The flaw was corrected by clamping requests to the end of the data, and by checking every count reported by the C library against the buffer capacity.",
"evidence": "osv:RUSTSEC-2026-0398",
"products": [
{
"name": {
"value": "zstd-safe",
"evidence": "/affected/0/package/name"
},
"prerequisites": [],
"fixed_versions": [
{
"value": "8.2.0",
"evidence": "/affected/0/ranges"
}
],
"affected_versions": []
}
],
"severity": "unknown",
"structured": {
"id": "RUSTSEC-2026-0398",
"aliases": [
"RUSTSEC-2026-0398"
],
"affected": [
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "7.2.2"
},
{
"fixed": "8.2.0"
}
]
}
],
"package": {
"name": "zstd-safe",
"purl": "pkg:cargo/zstd-safe",
"ecosystem": "crates.io"
},
"database_specific": {
"cvss": null,
"source": "https://github.com/rustsec/advisory-db/blob/osv/crates/RUSTSEC-2026-0398.json",
"categories": [
"memory-exposure",
"memory-corruption"
],
"informational": null
},
"ecosystem_specific": {
"affects": {
"os": [],
"arch": [],
"functions": [
"zstd_safe::seekable::AdvancedSeekable::decompress",
"zstd_safe::seekable::Seekable::decompress"
]
},
"affected_functions": null
}
}
],
"modified": "2026-10-26T14:00:05.092082939Z",
"provider": "osv",
"references": [
"https://crates.io/crates/zstd-safe",
"https://rustsec.org/advisories/RUSTSEC-2026-0398.html",
"https://github.com/gyscos/zstd-rs/commit/80506be743fae2ed0c2fe8b21c374c6a2eab0be7",
"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": 454192,
"published_at": "2026-10-16T12:00:00+00:00"
}