Skip to content

Releases

v1.1.0

Choose a tag to compare

@github-actions github-actions released this 04 Oct 17:25

Security and Correctness

  • ZIP64 Entry Count Preflight: ZipCentralDirectoryParser checks entry counts against limits.maximumEntries and physical central directory byte capacity before allocating memory. This prevents integer overflow traps and process crashes on malformed archives declaring oversized entry counts.
  • Extra Field Bounds: ZIP64 extra fields (0x0001) are strictly bounded to their declared length, preventing the parser from reading past extra fields into comments or adjacent headers.
  • Exact DEFLATE Stream Validation: ZipDeflateEngine.decompressWholeBuffer verifies that zlib's total_out matches the destination buffer length before computing CRC or returning data, preventing uninitialized heap reads. Streaming decompression requires Z_STREAM_END and rejects truncated streams or missing final blocks (BFINAL=0).
  • Buffer Ownership Safety: ZipDeflateEngine.decompress emits owned Data chunks to consumers instead of exposing the reusable internal output buffer.
  • Compression Method Filtering: ValidatedArchiveIndex throws ArchiveFailure.unsupportedEntry for any compression method other than 0 (stored) or 8 (DEFLATE). Unsupported codecs no longer fall through to stored reads.
  • Writer Integrity & Quotas: ZipBinaryWriter aborts with invalidSource if input files shrink or mutate during streaming, validates the maximumArchiveBytes budget before every write, and writes required ZIP64 extra fields (tag 0x0001, version 4.5) when member sizes or offsets exceed 4 GB.
  • CRC-32 Buffer Chunking: ZipChecksum chunks buffers larger than 4 GB into uInt.max slices to avoid 32-bit integer truncation when calling zlib.crc32.
  • CLI Error Reporting: ZipMelloCLI catches runtime errors, writes them to stderr, and exits with status 1 instead of trapping.
  • Regression Suite: Added AuditRegressionTests covering malformed entry counts, comment-boundary reads, truncated DEFLATE streams, and cancellation edge cases.

Performance

  • Zero-Copy Stored and Whole-Buffer Reads: Memory allocations for stored entries and whole-buffer DEFLATE bypass zero-fill overhead by wrapping uninitialized buffers in Data(bytesNoCopy:), guarded by exact size checks and CRC-32 verification.
  • Inlined Single-Lane Fast Path: ArchiveReader executes reads directly on an inlined worker when concurrency lanes are not requested, eliminating queue hops and actor dispatch overhead.
  • Precomputed Alias Indexing: Added ArchiveAliasIndex to precompute canonical and percent-decoded aliases at open time. Case-insensitive lookups in ArchiveMemoryReader now run in $O(1)$ time rather than scanning all archive members on every read.
  • Incremental Cache Byte Tracking: ArchivePageStore tracks allocated bytes using a running counter rather than reducing all cached entry sizes on each lease reservation.
  • Page Prefetch Tuning: Default ArchiveTuning.pagePrefetch sets wholeBufferDeflateLimit: 4 * 1024 * 1024 (4 MB) alongside 4 read lanes.

Concurrency and Caching

  • Cooperative Lease Cancellation: When all callers waiting on a page extraction cancel (such as during fast vertical scrolling), ArchivePageStore cancels the underlying extraction task immediately, avoiding redundant disk I/O and decompression work.
  • Lookup Policy Isolation: Request keys in ArchivePageStore include the lookup policy (.exact vs .compatible), ensuring case-insensitive lookups do not satisfy or contaminate subsequent exact-path lookups.
  • Archive Open Throttling: Metadata extraction operations share the page store's concurrency permit queue, preventing concurrent bursts across different archives from exhausting session limits.
  • Cache Telemetry: Added hits, evictions, queuedRequests, peakQueueDepth, and cancelledBeforeExtraction metrics to ArchivePageStore.Statistics.
  • Configurable Store Concurrency: Added maximumExtractions (default 4) and tuning (default .pagePrefetch) parameters to ArchivePageStore.init.

Benchmarks and Project

  • Standalone Benchmark Package: Added a standalone SwiftPM package in Benchmarks/ comparing ZipMello against ZIPFoundation across 6 comic-reader workloads and a continuous scroll simulation.
  • Test Fixtures: Added an 80-page synthetic CBZ fixture generator using Pepper & Carrot pages by David Revoy (CC-BY 4.0).
  • Submodule Cleanup: Removed .gitmodules.
  • Licensing: Added MIT LICENSE file.
  • Documentation: Updated README.md and Benchmarks/README.md with benchmark methodology, architectural patterns, and verified buffer boundaries.

Full Changelog: v1.0.0...v1.1.0

v1.0.0

Choose a tag to compare

@github-actions github-actions released this 01 Oct 22:01