RustSec logo

History ⋅ Edit ⋅ JSON (OSV)

RUSTSEC-2026-0405

Out-of-bounds read with an out-of-range InBuffer::pos

Reported
Issued
Package
zstd-safe (crates.io)
Type
INFO Unsound
Categories
Keywords
#seekable #out-of-bounds
References
Patched
  • >=8.2.0
Unaffected
  • <7.2.2
Affected Functions
Version
zstd_safe::seekable::SeekableCStream::compress_stream
  • >=7.2.2, <8.2.0

Description

InBuffer's fields are public, so safe code can set pos past the end of src. The position was passed to the C library unchecked, and ZSTD_seekable_compressStream, unlike the other streaming functions, does not validate it: it read past the end of the input slice, by up to the frame size, and compressed that memory into the output.

The flaw was corrected by checking the position before every call into the C library.

Advisory available under CC0-1.0 license.