Zstandard
Zstandard is a lossless compression format and codec that stores data in frames with optional external dictionaries and content checksums.
Concatenated frames decode to concatenated output. A valid remaining frame does not prove that an intended later frame is still present. [4] [6]
Seekable Zstandard adds a seek table in a final skippable frame, allowing a range to be located without decoding the entire preceding stream. Ordinary Zstandard framing does not itself provide that index. [5]
The measured CLI experiment distinguishes a checksum stored in a frame from read-time verification: explicitly ignoring the checksum accepted wrong dictionary-derived bytes. Its payload oracle also accepted changed skippable metadata because those bytes were not part of decoded output. [6]
A frame dictionary ID can reject a differently labeled dictionary without a content checksum. Conversely, matching IDs did not detect a controlled dictionary-content mutation in Hesela's formatted-dictionary experiment; the verified content checksum caught that particular mismatch. [6]
The v1.5.7 reference seekable reader returned byte 65 for offset 64 after indexed lengths changed from 64/64 to 63/65. It also returned all 192 expected bytes without exposing a bad final checksum. [9]
The range loop can stop before frame completion triggers checksum verification; the frame wrapper uses the same routine. Validate physical frames, index geometry and intended generation separately. Keep the source unmodified for the reader lifetime. [7] [8]
In twelve synthetic runs, pipefail reported decoder failure but did not undo the consumer's writes; whole-frame removal still exited zero. Staging gated on decoder status and full expected bytes preserved rejected destinations: not a crash-durability guarantee. [11] [10]
Relations
- related
- Compression dictionary, Checksum, Backup verification, Transparent filesystem compression, Skippable frame, Zstandard dictionary ID, Decompression bomb, Zstandard window size, Lossless compression, Asymmetric numeral systems, Finite State Entropy, LZ77
Limitations
- On python-zstandard 0.24.0/0.25.0, max_output_size did not cap known-size output; C-extension strict suffix handling depended on buffer slack, unlike CFFI. [1] [2] [3]
- Both tested one-shot backends returned empty bytes for damaged or header-only empty-frame inputs; incremental controls distinguished error from incomplete EOF. [3]
- Incremental output can be allocated before a caller checks its size; changing APIs does not establish a production memory limit. [2]
Citations
- python-zstandard 0.25.0 pinned C extension: Decompressor_decompress allocation, resize and empty-frame branches
- python-zstandard 0.25.0 pinned CFFI backend: ZstdDecompressor.decompress
- Hesela: 192 bounded Python Zstandard API observations, generated table and pinned source hashes
- RFC 8878: Zstandard Compression, sections 3.1, 3.1.1.1.3 and 5
- Zstandard seekable format 0.1.0, pinned to v1.5.7
- Hesela: Compressed archives, dictionary dependencies and validation coverage
- Zstandard v1.5.7 reference seekable decoder: range completion and checksum checks
- Zstandard v1.5.7 seekable API: read semantics and source lifetime
- Hesela: native seekable-decoder observations, source fingerprints and reproduction
- Zstandard v1.5.5 API: streaming decompression completion and output
- Hesela: twelve synthetic decoder-output and publication observations
- Pillai et al.: All File Systems Are Not Created Equal, OSDI 2014, sections 2.2, 3.2-3.6 and 4.4
Sources & caveats
- 192 small native calls on two pinned package versions, both using libzstd 1.5.7; twelve synthetic fixtures and separate-session same-host replay. No external peer replication, measured memory consumption or claim about other wrappers. [3]
- Format facts follow RFC 8878 and the seekable extension. The linked experiment measures CLI 1.5.5 behavior on synthetic data, not a compression benchmark.
- The seekable study retains 30 synthetic fixtures, 480 isolated actions per capture and 119 C controls per configuration on one host. Its two linked cores use one reference decoder; publication summarizes existing captures, not a new native replay. [9]
- Atomic replacement during normal execution is separate from persistence after a crash. ALICE's historical study analyzes ordering, atomicity and durability assumptions; the linked staging experiment does not reproduce that crash testing. [12]