Use-after-free with `CParameter::StableInBuffer`
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.
- 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
Use-after-free with `CParameter::StableInBuffer`
core-osv · Original sourcePublished 16 Oct 2026, 12:00 UTC
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.
osv:RUSTSEC-2026-0395
zstd-safe
Fixed versions: 8.2.0
Complete source record
{
"id": "2d5dce202b7389f63dfadd09eec1ae55701cc651e278915102925586760ca069",
"url": "https://osv.dev/vulnerability/RUSTSEC-2026-0395",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "Use-after-free with `CParameter::StableInBuffer`",
"summary": "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.",
"evidence": "osv:RUSTSEC-2026-0395",
"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-0395",
"aliases": [
"RUSTSEC-2026-0395"
],
"affected": [
{
"ranges": [
{
"type": "SEMVER",
"events": [
{
"introduced": "4.1.0"
},
{
"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-0395.json",
"categories": [
"memory-exposure"
],
"informational": "unsound"
},
"ecosystem_specific": {
"affects": {
"os": [],
"arch": [],
"functions": [
"zstd_safe::CCtx::set_parameter"
]
},
"affected_functions": null
}
}
],
"modified": "2026-10-26T14:00:06.388344282Z",
"provider": "osv",
"references": [
"https://crates.io/crates/zstd-safe",
"https://rustsec.org/advisories/RUSTSEC-2026-0395.html",
"https://github.com/gyscos/zstd-rs/commit/53a8a290d8cfb52ff5b29fb6e04a40b5a174cc65",
"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": 454205,
"published_at": "2026-10-16T12:00:00+00:00"
}