Skip to content

Releases

v0.14.2

Choose a tag to compare

@gyscos gyscos released this 10 Oct 13:52

zstd 0.14.2

This release adds decoder APIs that let archive libraries recover their readers
without consuming more compressed input or losing ownership on initialization
errors.

  • Add stream::read::Decoder::into_inner(), which returns the underlying reader
    at its current position without additional I/O. This supports raw copying of
    compressed archive entries. Addresses #381
    and the regression reported in #380.
  • Add Decoder::try_new, try_with_buffer, try_with_dictionary,
    try_with_prepared_dictionary, and try_with_ref_prefix. These return
    Result<Self, (R, io::Error)>, preserving the original reader if decoder
    initialization fails. Addresses #382.
  • Return an I/O error if a streaming decoder cannot allocate its decompression
    context, instead of panicking.
  • Clarify that finish_frame() can stop before the end of a frame when decoded
    output remains unread.

Decoder::finish() keeps its 0.14 behavior: it attempts to consume remaining
frame input before returning the reader. Archive libraries that need to recover
compressed bytes should use into_inner() and adopt the new try_* constructors
where they need to retain the reader after initialization failure. Existing
constructor signatures remain unchanged.

Rust 1.64 remains supported.

v0.14.0

Choose a tag to compare

@gyscos gyscos released this 04 Sep 19:04

Breaking

  • The with_prepared_dictionary() constructors now borrow the dictionary for as long as the stream (#372). The dictionary is registered with the underlying context by pointer, so dropping it early left the stream with a dangling pointer - reachable from safe code.
  • The project is now licensed under BSD-3-Clause (#360, #314).
  • Requires zstd-safe 8.0.0.

Fixed

  • Decoder::finish() now consumes the rest of the frame, so the reader is handed back positioned just after it (#251, #255). zstd can produce the last of the decoded data before it has read the frame epilogue, so a caller who stops reading once it has the bytes it wanted used to get its reader back pointing inside the frame. Note that finish() may now read from the underlying reader; Decoder::finish_frame() is the same operation with the error surfaced.
  • Read::read() with an empty buffer returns Ok(0) instead of an error (#318).

New

  • Decoder::finish_frame(), to consume the rest of the current frame explicitly.
  • bulk::Compressor::set_pledged_src_size() (#320).
  • The missing with_context constructors (#338).
  • cmake and vendored features, forwarded to zstd-safe.

zstd-sys v2.1.0

Choose a tag to compare

@gyscos gyscos released this 04 Sep 19:04

Breaking

  • The bindgen feature is no longer enabled by default (#371). The pre-generated bindings are used unless you opt in, so libclang is no longer needed for a default build. This makes hermetic and cross builds much easier (#370).
  • The project is now licensed under BSD-3-Clause (#360, #314).

New

  • cmake feature: build the C library with zstd's own CMake files instead of cc, which handles cross-compilation better (#229).
  • vendored feature: always build the bundled C source, even when pkg-config is enabled, so a dependent crate can force a static build (#309).

Fixed

  • The wasm shim's qsort and memcmp are now unsafe (#367).
  • The x86-64 assembly is only built for x86_64 targets. It could never contribute code elsewhere - upstream gates it on __x86_64__ - and some toolchains, wasm ones especially, cannot process .S input at all (#368).
  • -fvisibility=hidden is no longer passed to MSVC (#352), and that is now decided from the target rather than the host, so cross-compiling to a *-windows-msvc target works too.

zstd-safe v8.0.0

Choose a tag to compare

@gyscos gyscos released this 04 Sep 19:04

Breaking

  • CCtx::ref_cdict() and DCtx::ref_ddict() now borrow the dictionary for as long as the context. zstd stores the dictionary in the context by pointer and dereferences it on every later operation, so safe code could previously drop the dictionary and cause a use-after-free.
  • AdvancedSeekable no longer implements DerefMut (#366). Handing out a &mut Seekable let safe code mem::swap() the context out and leave the swapped-out one holding a pointer to a reader this type frees on drop. decompress() and decompress_frame() are available directly on AdvancedSeekable instead, and Deref still covers the read-only queries.

Fixed

  • A context is no longer reused after an error left it in a state zstd considers undefined (#315). zstd documents calling the streaming functions again on such a context as undefined behaviour; they now return the original error until something resets the context.
  • Cursor positions are no longer truncated when converted to usize, which on a 32-bit target could turn an out-of-range position into a small in-range one and read or write the wrong part of the buffer.
  • Seekable::init_advanced() no longer leaks the boxed reader when initialization fails.

Other

  • New cmake and vendored features, forwarded to zstd-sys.
  • ResetDirective derives Copy, Clone, Debug, PartialEq and Eq, like the crate's other parameter enums.
  • The Send and Sync impls carry safety comments explaining why they hold.

v0.13.0

Choose a tag to compare

@gyscos gyscos released this 11 Oct 15:46
  • Bump zstd-safe to 7.0.0.
  • Fix potential buffer overflow (#231).
  • Some doc improvement.

zstd-sys v2.0.9

Choose a tag to compare

@gyscos gyscos released this 11 Oct 15:47
  • Fix build on wasm32 using default features
  • Fix allocation issues in wasm32
  • Use core::ffi rather than libc type aliases
  • Include zstd error methods and types in experimental bindings
  • Update bindgen from 0.64 to 0.68

zstd-safe v7.0.0

Choose a tag to compare

@gyscos gyscos released this 11 Oct 15:47
  • OutBuffer::dst is no longer public.
  • Added OutBuffer::as_mut_ptr and OutBuffer::capacity.
  • Replaced libc with core::ffi for type aliases.

v0.11.0

Choose a tag to compare

@gyscos gyscos released this 09 Mar 20:51

Breaking changes

  • Moves dictionary-training operations behind a zdict_builder default feature.
    Using a dictionary does not need this feature; only training/creating a new one does.
  • Disable exporting unrelated constants in zstd-sys.

Updates

Can now compile for wasm32-unknown-unknown target.

v0.10.0

Choose a tag to compare

@gyscos gyscos released this 27 Jan 14:26

Breaking changes

  • Rename the block module to bulk. It was never really zstd' "block" API (which apparently might not even stay public forever), but just a way to compress data that fits entirely in-memory.
    • It was also refreshed to be on-par with the stream API regarding dictionaries and compression parameters.

Updates

  • Update zstd to 1.5.2
  • zstd_safe: Add {C,D}Ctx::try_clone to clone an existing context. Note that this only clones the compression parameters, not the current "stream context". As such, it should only be called before any data has been sent.
  • Documentation: add doc-cfg tags to indicate the features required for each type/function.

0.9.1

Choose a tag to compare

@gyscos gyscos released this 03 Jan 17:46

This bumps the zstd version to 1.5.1.

It also brings some improvements to the rust wrapper:

  • Functions to turn on multithreaded compression are only available when the zstdmt feature is enabled
  • Implementations for arrays in zstd-safe use const-generics, and are now gated behind an arrays feature to allow compatibility with old compilers.
  • Add set_pledged_src_size to encoders. This can improve the compression ratio, and makes the content size available in the compressed header.
  • Add an auto-flush wrapper to the push decoder.