Skip to content

zstd 0.14.5

Latest

Choose a tag to compare

@gyscos gyscos released this 24 Nov 16:16

zstd 0.14.5, zstd-safe 8.4.0, zstd-sys 2.2.0

This release bundles zstd 1.6.0, which fixes
CVE-2026-124851 and a
batch of memory-safety bugs (upstream release notes).
Updating is recommended. It also fixes three soundness issues in zstd-safe
(#401, #415, #416).

With pkg-config, the system's zstd library is used instead of the bundled
one: update it to 1.6.0 to get the upstream fixes.

Rust 1.64 remains supported.

zstd-sys 2.2.0+zstd.1.6.0

  • Bundle zstd 1.6.0 (#420, thanks @emschwartz). It also fixes the wasm build
    with zstd 1.6.0.
  • zstd 1.6.0 made these part of its stable API, so they no longer need the
    experimental feature: ZSTD_getFrameHeader, ZSTD_FrameHeader,
    ZSTD_FrameType_e, ZSTD_createDDict_byReference,
    ZSTD_CCtx_loadDictionary_advanced, ZSTD_DCtx_loadDictionary_advanced,
    ZSTD_dictContentType_e and ZSTD_dictLoadMethod_e.
  • experimental: zstd 1.6.0 removed ZSTD_copyCCtx and ZSTD_copyDCtx, and
    added ZSTD_isDeterministicBuild.
  • zstd 1.6.0 disables legacy format support by default, but the legacy
    feature keeps working as before (on by default).

zstd-safe 8.4.0

New API:

  • get_frame_header() returns a frame's header (FrameHeader, zstd's own
    struct), or how much of the frame it needs (FrameHeaderStatus).
    get_frame_header_advanced() takes a FrameFormat (experimental).
  • CCtx::load_dictionary_advanced() and DCtx::load_dictionary_advanced()
    take a DictContentType. ref_dictionary() borrows the dictionary instead
    of copying it.
  • DDict::create_by_reference() no longer needs experimental.
  • Worker threads with owned data: CCtx::set_cdict(), CCtx::set_prefix(),
    CCtx::compress_with_cdict(), CCtx::compress_with_prefix(),
    CDict::create_by_reference_owned() (experimental), and
    CCtx::frame_workers(), which tells how many workers a frame gets.

Fixes:

  • Leaking a CCtx in the middle of a multithreaded frame that reads a
    borrowed dictionary or prefix no longer lets the workers read it after the
    borrow ends (#401, #411).
  • The block API no longer reads memory that an earlier one-shot call only
    borrowed, or state zstd never set up (#415, #417).
  • NoOp no longer writes through a stale pointer when a WriteBuf's
    capacity changes between calls (#416, #417).
  • Worker tracking stays in step with zstd: in compress2() when the
    destination panics, with stale pledged sizes, and with clamped
    NbWorkers (#407).
  • One-shot calls end their session before the WriteBuf runs, so a
    panicking destination no longer leaves the context pointing at borrowed
    buffers (#409).

Behaviour changes:

  • With worker threads, a streaming frame that reads borrowed data (a prefix
    from ref_prefix(), a CDict made by create_by_reference(), a dictionary
    from ref_dictionary()) runs on the calling thread, and JobSize,
    OverlapSizeLog and RSyncable have no effect on it. compress2() and
    the owned variants above keep the workers.
  • NbWorkers is refused (parameter_unsupported) without the zstdmt
    feature, even when the linked zstd library has threads. zstdmt now
    enables alloc.
  • compress_block() / decompress_block() run in block sessions of their
    own: any other &mut self method ends the session, and a failed block
    call poisons the context until a reset.
  • WriteBuf's contract now says its capacity and pointer must not change
    while zstd-safe uses the buffer (they may between uses, as a Vec's
    does). Every implementation in this crate already did; check your own
    unsafe impl WriteBuf.

zstd 0.14.5

  • DecoderDictionary::new() and try_new() no longer need experimental.
  • EncoderDictionary is Clone, and EncoderDictionary::from_cdict() wraps
    any prepared dictionary. Encoders and compressors keep their own handle, so
    with_prepared_dictionary() only needs the dictionary's bytes to outlive
    them.
  • write::Encoder::with_prefix() takes a prefix the encoder owns, and
    bulk::Compressor::compress_with_prefix() borrows one for a single call:
    both keep the worker threads.
  • Out of memory: failing to allocate a compression context now returns an
    OutOfMemory error instead of panicking. The decoders report
    OutOfMemory (they said Other), and so does zstd's own
    memory_allocation error, which no longer carries a zstd::Error. None
    of these errors allocate (#414, thanks @gleocadie, and #418).
  • write::Encoder no longer writes a second, empty frame when flushed while
    a finish is being retried. Behaviour change: write() in that state
    returns the "encoder is finished" error (#404).
  • AutoFinishEncoder and AutoFlushDecoder no longer abort the process
    when the writer or callback panics while another panic unwinds (#404).

Upgrading with the experimental feature

zstd-safe up to 8.2 has CCtx::try_clone() and DCtx::try_clone() behind
experimental, and they call the functions zstd 1.6.0 removed: with
experimental, those versions no longer build against zstd-sys 2.2.0.
Update to zstd-safe 8.4.0 (zstd 0.14.5), or stay on the previous zstd-sys
with cargo update -p zstd-sys --precise 2.1.3+zstd.1.5.7.

The same applies to the 0.13 line: zstd 0.13 picks up zstd-sys 2.2.0 (and
zstd 1.6.0) on cargo update, except with experimental.