Repository navigation
Releases
Releases · Tiny-Melo/zipmelo
v1.1.0
Security and Correctness
- ZIP64 Entry Count Preflight:
ZipCentralDirectoryParserchecks entry counts againstlimits.maximumEntriesand 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.decompressWholeBufferverifies that zlib'stotal_outmatches the destination buffer length before computing CRC or returning data, preventing uninitialized heap reads. Streaming decompression requiresZ_STREAM_ENDand rejects truncated streams or missing final blocks (BFINAL=0). - Buffer Ownership Safety:
ZipDeflateEngine.decompressemits ownedDatachunks to consumers instead of exposing the reusable internal output buffer. - Compression Method Filtering:
ValidatedArchiveIndexthrowsArchiveFailure.unsupportedEntryfor any compression method other than0(stored) or8(DEFLATE). Unsupported codecs no longer fall through to stored reads. - Writer Integrity & Quotas:
ZipBinaryWriteraborts withinvalidSourceif input files shrink or mutate during streaming, validates themaximumArchiveBytesbudget before every write, and writes required ZIP64 extra fields (tag0x0001, version 4.5) when member sizes or offsets exceed 4 GB. - CRC-32 Buffer Chunking:
ZipChecksumchunks buffers larger than 4 GB intouInt.maxslices to avoid 32-bit integer truncation when callingzlib.crc32. - CLI Error Reporting:
ZipMelloCLIcatches runtime errors, writes them tostderr, and exits with status 1 instead of trapping. - Regression Suite: Added
AuditRegressionTestscovering 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:
ArchiveReaderexecutes reads directly on an inlined worker when concurrency lanes are not requested, eliminating queue hops and actor dispatch overhead. -
Precomputed Alias Indexing: Added
ArchiveAliasIndexto precompute canonical and percent-decoded aliases at open time. Case-insensitive lookups inArchiveMemoryReadernow run in$O(1)$ time rather than scanning all archive members on every read. -
Incremental Cache Byte Tracking:
ArchivePageStoretracks allocated bytes using a running counter rather than reducing all cached entry sizes on each lease reservation. -
Page Prefetch Tuning: Default
ArchiveTuning.pagePrefetchsetswholeBufferDeflateLimit: 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),
ArchivePageStorecancels the underlying extraction task immediately, avoiding redundant disk I/O and decompression work. - Lookup Policy Isolation: Request keys in
ArchivePageStoreinclude the lookup policy (.exactvs.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, andcancelledBeforeExtractionmetrics toArchivePageStore.Statistics. - Configurable Store Concurrency: Added
maximumExtractions(default 4) andtuning(default.pagePrefetch) parameters toArchivePageStore.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
LICENSEfile. - Documentation: Updated
README.mdandBenchmarks/README.mdwith benchmark methodology, architectural patterns, and verified buffer boundaries.
Full Changelog: v1.0.0...v1.1.0
v1.0.0
Full Changelog: https://github.com/ChrisRodStar/zipmello/commits/v1.0.0
Full Changelog: https://github.com/ChrisRodStar/zipmello/commits/v1.0.0