github hellobertrand/zxc v0.9.0
ZXC v0.9.0

7 hours ago

Release Notes

This release introduces the Reusable Context API, configurable block sizes, a comprehensive API & ABI reference, and several security fixes; including a heap-buffer-overflow found by fuzzing the compression path.

SOVERSION bumped to 2: this release contains ABI-breaking changes.

Breaking Changes

  • SOVERSION 2: The shared library ABI version has been incremented. Binaries compiled against SOVERSION 1 must be recompiled.
  • Options structs: zxc_compress() and zxc_decompress() now take zxc_compress_opts_t* / zxc_decompress_opts_t* instead of positional parameters. Pass NULL for default behavior.
  • Block size encoding: The file header now stores block size as a log2 exponent [12..21] instead of the previous dual-scale encoding. Legacy value 64 is still accepted for backward compatibility.

New Features

Reusable Context API

Opaque, heap-allocated compression and decompression contexts that eliminate per-call allocation overhead, ideal for filesystem plug-ins (squashfs, dwarfs) and batch processing:

  • zxc_create_cctx() / zxc_free_cctx() / zxc_compress_cctx()
  • zxc_create_dctx() / zxc_free_dctx() / zxc_decompress_dctx()

Internal buffers are only reallocated when block_size or level changes between calls.

Configurable Block Sizes

  • Block size is now configurable via the block_size field in zxc_compress_opts_t.
  • Valid range: 4 KB - 2 MB (power of two).
  • Default remains 256 KB.
  • CLI: new --block-size or -B option with unit suffixes (4K, 1M, or 4KB, 1MB etc.).

Direct Decompression Fast Path

  • When the destination buffer is sufficiently padded, decompression skips the intermediate work buffer copy, reducing memory traffic and latency.

Security & Stability

  • Fix: heap-buffer-overflow in bitpacking (zxc_bitpack_stream_32): The packing loop could write up to 4 bytes past the output buffer when the last packed value straddled a byte boundary.
  • Fix: stream validation during decompression (zxc_decompress.c): Added validation to ensure the sequence stream size is sufficient for the declared number of sequences, preventing out-of-bounds reads.
  • Block size validation: Both zxc_cctx_init() and zxc_read_file_header() now validate that block sizes are within [ZXC_BLOCK_SIZE_MIN, ZXC_BLOCK_SIZE_MAX] and are powers of two.
  • C++ compatibility: All public headers now include extern "C" guards for seamless C++ consumption.
  • Fuzzing corpus storage: Configured persistent corpus storage for ClusterFuzzLite CI.

Documentation

  • docs/API.md: New comprehensive API & ABI reference documenting all 21 exported symbols, type definitions, visibility strategy, ABI versioning, thread safety guarantees, and error handling patterns.
  • Updated man page and README with installation instructions and packaging status (vcpkg, Conan, Homebrew).
  • Updated docs/FORMAT.md for exponent-based block size encoding.

Wrappers

All language wrappers updated to use the new options struct API:

  • Python: Updated CFFI bindings for options structs.
  • Rust: Updated FFI layer and safe wrapper for options structs and reusable context API.
  • Node.js: Updated N-API bindings for options structs.

Changes

Full Changelog: v0.8.3...v0.9.0

Don't miss a new zxc release

NewReleases is sending notifications on new releases.