Skip to content

Research notes / Archive recoverability

Compressed archives: intact bytes can still be unreadable

Published / Updated / Designed recovery experiments

A restore must recover the intended content, finish every required decoder and member check, and propagate validation failures. Matching length or exit status alone cannot establish this. Our bounded Zstandard, TAR, gzip, ZIP, XZ and CPIO experiments isolate missing dependencies, duplicate names, incomplete reads and misleading success signals. The tables below distinguish format rules from observations on specific software builds.

On this page40 sections

What a lossless round trip preserves

Lossless compression reconstructs the encoder's input exactly. For the byte-oriented formats discussed here, decoding must recover the same byte sequence, not merely the same length or readable text. The promise starts at the encoder input: discarding file metadata before compression cannot make that metadata recoverable. [RFC 8878, section 2]

Exact recovery does not require a unique compressed representation. Different encoding choices can produce different compressed bytes that decode to the same payload. It also does not promise a smaller file: no lossless compressor can shrink every possible input. Keep the data-reduction ratio and its measured storage footprint separate from the codec's reversibility. [RFC 1951, sections 1.1 and 4]

Why every file cannot get smaller

Fix the decoder and all external context. There are 65,536 possible two-octet inputs, but only 257 shorter octet strings: the empty string and 256 one-octet strings. Exact recovery requires distinct inputs to have distinct encodings, so at most 257 inputs can become shorter and at least 65,279 cannot. We generously allow a known object boundary and ignore framing cost. A format that forbids empty outputs or needs headers can do worse. [RFC 1951, section 1.1]

This is exact counting over all two-octet strings, not a measured workload or a prediction for ordinary files. The executable calculation uses (256n - 1) / 255 shorter strings for n input octets. Dictionaries or identifiers that vary per object must be included in the representation; otherwise information has merely moved elsewhere. Shannon's source-coding theorem addresses average rates for a specified source, not savings on every file. [Shannon, sections 9-10]

The remaining recovery obligations are separate. A frame may need an external dictionary; an optional checksum may not be checked. The verification controls below examine those conditions. Byte-preserving compression is a format property, not evidence that a particular damaged archive was fully validated. [RFC 8878, sections 3 and 3.1.1.1.3]

A short run still needs decoding context

Run-length encoding replaces a repeated value sequence with a compact description. In a Zstandard RLE block, one content byte expands to the count in Block_Size; the three-byte block header and frame overhead remain separate. A decoder must check the permitted output size before expansion. [RFC 8878, section 3.1.1.2]

Bit packing instead places values into bit fields. Arrow uses it for Boolean values and validity flags, while buffer padding and alignment still contribute to memory use. Payload bits are not allocated bytes. [Arrow layout]

Width 3, eight values; hexadecimal hybrid-run bytes, including the run header but excluding external width information and page framing. Exact format arithmetic, not a measured compression ratio.
ValuesPacked runRepeated run
0 through 703 88 c6 faNot one repeated run
Eight copies of 503 6d db b610 05

Parquet's hybrid header distinguishes a packed group count from a repetition count. The same repeated input above has two valid representations. Deprecated BIT_PACKED has different ordering; the decoder needs the encoding identifier and width, not just these bytes. [Parquet encodings]

Where the run ends depends on the page

Parquet prefixes level streams with a four-byte encoded length in data page v1, but omits that prefix in v2. Dictionary indices omit it in both versions and carry a bit-width byte instead; RLE Boolean streams retain the length prefix in both. A parser must select the enclosing format before interpreting the first run byte. [Parquet encodings, length-prefix table]

Packed values also need their schema meaning. Dremel's nested-column design uses repetition levels to locate repeated structure and definition levels to distinguish absent ancestors from present values. A decoded sequence of integers alone cannot reconstruct those records. The paper's record-assembly algorithm consumes levels and values together; it is not the Parquet wire specification. [Melnik et al., sections 4.1-4.3]

The bounded arithmetic example and regression tests cover unsigned fields and run headers, not complete Parquet pages, checksums or corruption rates. This is a format illustration; its short fragments are not independently recoverable archives.

A shared base shrinks offsets; outliers widen the block

Frame-of-reference encoding stores offsets from a shared base, often a block minimum. This differs from subtracting the previous value. In Parquet's DELTA_BINARY_PACKED encoding, the two transformations are composed: first adjacent differences, then subtraction of the block's minimum difference, then bit packing per miniblock. [Parquet specification]

Exact integer illustration; base 1000 in both rows. The second row appends 2024. Width is bits per offset; Bits is total offset payload. Excludes base, width, count fields, padding and all framing.
InputOffsetWidthBits
Clustered values
1000, 1001, 1003, 1007
0, 1, 3, 7312
Append one outlier
1000, 1001, 1003, 1007, 2024
0, 1, 3, 7, 10241155

Four clustered values need 12 offset bits. Appending one outlier raises the maximum offset to 1024, so all five fixed-width fields now need 11 bits each: 55 payload bits. A constant block can instead use zero offset bits if its base and count are retained. These are payload calculations, not stored-file sizes.

Keep exceptions separate, but count their cost

Patched frame-of-reference schemes select a packed width and preserve exceptional values separately. An unsigned value at or above 2^b does not fit b bits. Exception locations and data have a cost, so the narrowest main stream need not give the smallest complete representation. PFOR, NewPFD and FastPFOR use different layouts and width-selection rules. [Lemire and Boytsov, sections 2.6-2.8 and 5]

The original PFOR design can also choose a base above some inputs and store those below-base values as exceptions. PFOR-DELTA adds adjacent differencing before PFOR; it is a specific composition, not another name for every patched scheme. [Zukowski et al., section 3.1]

In our illustrative low/high split at width 3, the five low fields are 0, 1, 3, 7, 0. The last offset needs an exception at zero-based position 4 with high part 128: 128 * 8 + 0 = 1024. There are 15 low-field bits, plus the exception and metadata. This toy representation does not specify a PFOR wire format or show net space savings.

Preserve the reference and layout. Plain FOR reconstruction uses base + offset without a prefix sum once the block is located. That does not promise constant-time access through an entire file. Changing the base from 1000 to 2000 in the first example produces 2000, 2001, 2003, 2007 with unchanged offsets and width; valid reconstruction arithmetic is not an integrity check.

Overflow is part of the format. Parquet specifies two's-complement wraparound at the physical integer width for both subtraction and reconstruction. For a 64-bit transition from 2^63 - 1 to -2^63, the wrapped adjacent delta is 1; the unbounded mathematical difference is 1 - 2^64. Rejecting that signed overflow would reject a valid transition. [Parquet specification]

Parquet additionally requires the first value, counts, block geometry, minimum deltas and miniblock widths; its integer differences use the specified fixed-width overflow rules. Our exact arithmetic model and regression tests use mathematical BigInt offsets with signed-64-bit inputs, not a Parquet decoder or a benchmark.

DEFLATE block boundaries do not guarantee independent recovery

LZ77 names a copying approach, not a decoder input format. DEFLATE adds Huffman coding to history references; LZ4 blocks use byte-oriented tokens without an entropy-coding backend. Their backward-distance limits also differ: 32768 bytes for DEFLATE, 65535 for LZ4. Neither limit caps the total file size. A shared algorithmic family does not make compressed streams interchangeable. [RFC 1951] [LZ4 block specification]

The DEFLATE limit describes permitted streams, not how exhaustively a compressor searches. RFC 1951 allows a conforming compressor to use a smaller window or limit its search effort; a compliant decompressor must accept the full defined range. Compression settings can therefore change size and speed without changing the file format. Do not infer a particular encoder's search policy from the 32768-byte format limit. [RFC 1951, sections 3.3-4]

LZ4 blocks additionally require enclosing metadata, such as input size and an output bound, that the block format does not carry. Zstandard supplies its own frame, sequence and dictionary rules. For long-term recovery, record the concrete format and preserve required dictionary or history state; an LZ77 label alone is insufficient. [LZ4 metadata] [Zstandard specification]

DEFLATE and its wrappers are different layers. Raw DEFLATE supplies the encoded blocks; zlib and gzip add framing and payload checks. Selecting the wrong decoder mode is not evidence of damaged storage. [RFC 1950] [RFC 1952]

Format-level payload checks, not measured corruption-detection rates.
Input formatPayload checkFraming distinction
Raw DEFLATENo wrapper checksumEncoded blocks only
zlibAdler-32Header; optional preset-dictionary identifier
gzipCRC32Member header; size modulo 2^32 in trailer

Fixed or dynamic Huffman coding is local to a compressed block, but backward references can use earlier blocks. The 32768-byte distance limit is not a stream-size limit. Stored blocks allow at most 65535 data bytes; compressed blocks have no equivalent size cap. A block offset alone is therefore insufficient for random access when decoding requires earlier history. [RFC 1951, sections 2 and 3.2-3.3]

A match may also overlap its own output. After XY, length 5 at distance 2 appends XYXYX: each newly emitted byte can become history for the same match. A decoder starting at that block without the required history cannot reconstruct the intended bytes. [RFC 1951, section 3.2.3]

The underlying copying idea predates DEFLATE. Ziv and Lempel's 1977 paper describes reconstructing segments from a recent-output buffer and identifies error propagation as a drawback. Its theoretical compression bounds are not a measured recovery rate for modern archives. [Ziv and Lempel, introduction]

Checksum presence and enforcement are separate. RFC 1950 requires a zlib decoder to check Adler-32; RFC 1952 allows a compliant gzip decoder to skip trailer checks. For recovery, select and finish a reader that actually validates the required trailer rather than inferring validation from the format name. [RFC 1950, section 2.3] [RFC 1952, section 2.3.1.2]

Keep block boundaries, wrapper completion and archive coverage separate. The gzip completion controls below test caller behavior; they do not turn a raw decoder into a checksum validator. This comparison is source synthesis, not a new codec experiment.

Recover the dictionary and the format conventions

LZ78 builds phrases from an earlier phrase plus an extension symbol. Its final phrase can be incomplete. LZW starts with single-symbol strings and lets the decoder reconstruct new dictionary entries from the code sequence. Neither algorithm name identifies every convention needed to read a stored file. [Ziv and Lempel, 1978] [Welch, 1984]

Format requirements from GIF89a Appendix F and TIFF 6.0 section 13, not measured compression ratios.
Recovery ruleGIF89aTIFF 6.0
Code packingLeast-significant-bit firstHigh-to-low, independent of TIFF byte order
Width transitionsGIF growth convention; at most 12 bitsEarlier growth convention; at most 12 bits
Reset boundaryClear resets the table; a full table may remain frozenEach strip starts with Clear and is compressed independently
CompletionEnd of Information plus a separate data-sub-block terminatorEach compressed strip ends with End of Information

Changing bit order alone does not convert a GIF LZW decoder into a TIFF one. Preserve the format version, code-width transitions, restart boundaries and any preprocessing metadata. TIFF's optional horizontal differencing predictor must be reversed separately after LZW decoding. [GIF89a] [TIFF 6.0, sections 13-14]

A reconstructed dictionary need not be a separately archived file, unlike the external dictionary dependencies below. It is still decoder state: an arbitrary compressed offset is not automatically a restart point. This comparison is a source synthesis, not a native decoder test.

A probability model is part of the decoding contract

Entropy coding targets expected length under a model, not a smaller result for every file. Shannon's limit is an average for a specified stochastic source; a byte histogram ignores ordering and longer dependencies. [Shannon 1948, section 9]

Arithmetic coding narrows an interval for each symbol. The decoder needs the same model and a stopping rule. Practical formats also specify integer precision, renormalization and finalization; RFC 6716 describes one range coder, not a universal compressed-file format. [Witten et al. 1987, pp. 520-523] [RFC 6716, sections 4.1 and 5.1.5]

Exact teaching example: fix ordered probabilities A=3/4 and B=1/4, and supply length two externally. Choose the shortest binary-prefix cell fully inside each final interval. These are synthetic calculations, not Opus output or a benchmark.

Payload only; model, length, framing and integrity metadata excluded
MessageFinal intervalEnclosed binary cellPrefixBitsPacked bytes
AA[0, 9/16)[0, 1/2)011
AB[9/16, 3/4)[5/8, 3/4)10131
BA[3/4, 15/16)[3/4, 7/8)11031
BB[15/16, 1)[15/16, 1)111141

AA uses one payload bit, but AB needs three, compared with two fixed-width bits each. The four-message model-weighted mean is 31/16 bits, below two, while every separately byte-packed result still occupies one byte before the excluded costs. Encoding a longer joint stream is a different accounting boundary.

Model agreement matters independently of size: tag 5/8 decodes to AB for two symbols under this model, but to BB if the decoder swaps the probabilities. A valid arithmetic interval does not authenticate the model or the recovered message.

Reproduce the exact worksheet with the Python model, regression tests and machine-readable results. The model uses rational arithmetic and a declared binary-cell rule; it does not simulate finite-precision codec overhead.

Count symbols, not just phrases

Tunstall coding takes the opposite direction from symbol-wise Huffman coding: variable-length source phrases become fixed-width indices. For a known memoryless source and fixed index width, the classical construction maximizes expected phrase length. This is a model-specific objective, not a universal file-size optimum. [Drmota et al. 2006, sections I-II]

With the same A=3/4, B=1/4 model, use the four phrases AAA, AAB, AB and B. A constructed, not observed population containing 27, 9, 12 and 16 copies respectively has 64 phrases and 148 source symbols. Two-bit indices cost 128 payload bits: 32/37 bit per source symbol. Equivalently, divide 2 by the expected phrase length 37/16.

Averaging each phrase's own bits-per-symbol ratio using phrase probabilities gives 17/16. That is a valid phrase-weighted statistic, but not the aggregate coding rate: longer phrases contribute more source symbols. Binary symbol-wise Huffman uses one bit per symbol here; Huffman over blocks is a different comparison. The Tunstall and symbol-wise Huffman payload rates both exclude dictionary and framing costs.

The ending also matters: AA is not a complete phrase in this dictionary. A finite-file format must specify how to finish and recover that tail. The exact worksheet includes both denominators and the constructed counts; the Tunstall construction example covers dictionary generation and tail controls. No measured codec ranking follows from these calculations.

Prefix decoding is not an integrity check

Huffman coding optimizes codeword lengths for symbol frequencies. Canonical DEFLATE tables can be reconstructed from ordered code lengths, but decoding also needs block framing and length/distance semantics. A correct table is only one recovery dependency. [RFC 1951, sections 3.2.1-3.2.3]

Huffman's original construction repeatedly combines the two least likely messages. Its optimum is the smallest expected codeword length for the given probabilities under a prefix-code model and equal cost per coding digit. It is not a guarantee about every message, header cost or the smallest possible archive. Equal-probability choices can produce different optimal codes. [Huffman 1952, pp. 1098-1100]

Exact illustration: use A=0, B=10, C=110 and D=111. Eight A symbols, four B symbols, two C symbols and two D symbols take 28 payload bits, versus 32 for two-bit fixed-width symbols. Codebook and framing costs are excluded, so this is not a file-size saving claim.

The same codebook turns ABCD into 010110111. Changing its last bit gives 010110110, which still decodes completely, but to ABCC. Four valid symbols and unchanged length do not establish the intended content. This is a constructed counterexample, not a native decoder test or corruption-rate estimate. Compare with the separate wrapper checks.

Lengths need a mapping: swap C=110 and D=111 while keeping A and B unchanged. The lengths remain 1, 2, 3, 3 and the weighted cost stays 28 bits, but the unchanged 010110111 now decodes to ABDC. Canonical reconstruction removes this ambiguity only with the specified symbol order and assignment rules. Retain those rules with the lengths. [RFC 1951, section 3.2.2]

What codeword lengths can and cannot prove

A prefix-free code lets a decoder recognize a symbol as soon as its codeword ends, given the same codebook and a known starting boundary. Prefix freedom is sufficient for unique decoding, but not necessary. It does not by itself promise recovery of alignment after a lost bit. [Huffman 1952, pp. 1098-1099] [McMillan 1956]

For binary uniquely decodable codes, the Kraft sum sum(2^-length) is at most one. Conversely, lengths satisfying that bound admit a prefix-free assignment. The converse is an existence result, not validation of an arbitrary map. Both constructed maps below have lengths 1, 2, 2 and sum 1/2 + 1/4 + 1/4 = 1, but only the first is prefix-free. [McMillan 1956]

Exact synthetic codebooks, decoding the same three bits: 010
AssignmentA / B / CPrefix-free?Complete parses of 010
Prefix-free assignment0 / 10 / 11YesAB
Ambiguous assignment0 / 01 / 10NoAC or BA

In the second map, 0 | 10 is AC while 01 | 0 is BA. Checking only lengths or the Kraft sum accepts both maps and misses this ambiguity. DEFLATE avoids arbitrary assignment by specifying canonical reconstruction rules and symbol order; those conventions remain part of its decoding contract. [RFC 1951, section 3.2.2]

The table is generated from a bounded executable example with regression tests, not a general unique-decodability algorithm or a native codec experiment. Framing and integrity checks remain separate requirements.

Unique finite decoding can still require waiting

A uniquely decodable code gives each complete encoded finite message just one source-symbol sequence. This is weaker than prefix freedom: the codewords 0, 01, 11 are not prefix-free but are suffix-free, so a complete message can be parsed uniquely backwards. [Falucskai 2011] [Cassaigne and Nicolas, section 1.1]

Exact synthetic codebooks with different parsing guarantees
CodebookCodewordsPrefix-free?Uniquely decodable?
Prefix-free0 / 10 / 11YesYes
Nonprefix, uniquely decodable0 / 01 / 11NoYes
Ambiguous0 / 01 / 10NoNo

Delay is separate. With the middle codebook, 0 | 11 | 11 | ... and 01 | 11 | 11 | ... share arbitrarily long bit prefixes but begin with different symbols. Finite-message uniqueness therefore does not promise a uniform left-to-right decision bound. The displayed repeating patterns are a constructed argument, not infinite messages accepted by a file format.

Test the codebook, not a short sample. Sardinas-Patterson follows unmatched codeword suffixes; reaching the empty suffix proves ambiguity, while closing their finite reachability search without it proves uniqueness. Our bounded exact checker generates the table and throws if its resource budget runs out. Its tests include 0, 0010, 1001: no collision below ten bits, then 0 | 0 | 1001 | 0010 = 0010 | 0 | 1001 | 0. Short successful round trips alone would miss that ambiguity. [Falucskai 2008, section 1]

These are finite mathematical examples, not a codec benchmark. Neither a unique parse nor a terminating codebook test verifies intended content, file completeness or recovery after lost framing.

Rice parameters change the bit budget

Golomb-Rice coding splits an unsigned value u into quotient floor(u/2^k) and k remainder bits. FLAC writes that many zero bits, a one-bit terminator, then the remainder. It first maps signed residual x to 2x when nonnegative, or -2x-1 otherwise. [RFC 9639, section 9.2.7]

Six invented residuals: 0, -1, 1, -2, 2, 15. Their unsigned values are 0, 1, 2, 3, 4, 30. Exact payload bits only; no headers, parameters, predictor warm-up samples or checksums.
Parameter kPayload bits
046
131
226
327
431

Among these candidates, k=2 is smallest. Larger k shortens the unary quotient but lengthens every remainder. FLAC selects parameters per partition and reserves all-ones parameter fields for fixed-width escape coding. These choices and partition geometry belong to the format, not this payload-only calculation. [RFC 9639, sections 9.2.7.1-9.2.7.3]

Reproduce the exact calculations with the accompanying tests: node --test huffman-rice.test.mjs. The model uses exact integers, rejects invalid inputs and tests all four-symbol strings through length six. It constructs neither a DEFLATE stream nor a FLAC file; the separate FLAC experiments test actual reader behavior.

Entropy tables are recovery dependencies too

Asymmetric numeral systems (ANS) encode symbols into a state. Ordinary decoding removes them in the opposite order. Zstandard's Finite State Entropy (FSE) uses this family of ideas; rANS arithmetic is not its wire format. [Duda, sections 2.3 and 4]

Do not reverse an entire compressed block. FSE symbol bitstreams are read backward, while probability-table descriptions are read forward. The applicable table and initial state are both needed. [RFC 8878, sections 4.1-4.1.1]

Sequence-code modes, not literal-byte encodings. Source rules, not new decoder measurements.
ModeWhere decoding information comes from
PredefinedA format-defined distribution
RLEOne symbol supplied for that code type
FSE compressedA distribution described in this block
RepeatThe applicable earlier sequence table, or a dictionary table

Repeat mode without an earlier table in the same frame or a dictionary-provided table is corruption. Zero-sequence blocks do not replace sequence tables; repetition can also retain a predefined or RLE table. Reusing a table does not reuse the previous block's final decoding state. [Zstandard v1.5.7, sequence header and bitstream]

A small reversible-state check

Our exact-integer illustration assigns frequencies A=3 and B=1. Starting at state 4, pushing AAB yields states 5, 6, 27. Three pops return BAA and recover state 4. Encode the input in reverse to obtain forward decoding. This checks the rANS transition equations; it omits renormalization, byte framing and FSE tables. It is not a compression-ratio or speed measurement.

Arithmetic source and exhaustive bounded tests are executable with Node. A recoverable block needs its decoding context, not just an offset. See random-access verification for the separate index and checksum experiment.

A dictionary ID is not a dictionary

Zstandard permits independent frames and optional external dictionaries. The dictionary bytes are supplied separately; a frame's dictionary identifier does not contain them. That identifier can also be absent, so its absence does not prove the frame is self-contained. The optional content checksum stores the low 32 bits of XXH64 over decoded data. It is not an archive inventory or cryptographic authentication. [RFC 8878]

The CLI exposes dictionary selection through -D, checksum selection through --check and --no-check, and identifier omission through --no-dictID. We deliberately exercise those switches below. Defaults and options should be recorded, not inferred from a filename. [Zstandard CLI]

For block-level framing, see LZ4 block order and completion checks: twelve API cases distinguish intact blocks, declared length, content order and a finished frame.

For already damaged files, the bzip2 block-recovery experiment shows which fragments pass validation and why a damaged delimiter can affect two candidate blocks. Partial salvage needs an explicit record of gaps.

Fourteen cases: what did the check cover?

Our dictionary is 8,192 deterministic synthetic bytes. The 2,048-byte test payload is a slice of that dictionary, intentionally making dictionary dependence strong. The wrong dictionary inverts every bit without changing its length. These are raw-content dictionaries, not trained dictionaries with embedded identifiers. The harness checks that the produced frames omit a dictionary ID.

Observed on Zstandard 1.5.5. Payload acceptance requires exit code zero and exact equality with the full expected payload; it is not whole-archive acceptance.
CaseDecoder checksum policyExit codeOutput / expected bytesExact matchPayload accepted
No dictionary requiredVerify if present02048 / 2048YesYes
Correct raw dictionary; checksumVerify if present02048 / 2048YesYes
Missing raw dictionary; checksumVerify if present10 / 2048NoNo
Wrong raw dictionary; checksumVerify if present10 / 2048NoNo
Wrong raw dictionary; no checksumVerify if present02048 / 2048NoNo
Correct raw dictionary; no checksumVerify if present02048 / 2048YesYes
Both complete framesVerify if present022 / 22YesYes
Entire second frame removedVerify if present011 / 22NoNo
Final byte removedVerify if present122 / 22YesNo
Wrong dictionary; verification disabledIgnore02048 / 2048NoNo
Damaged checksum; verification enabledVerify if present10 / 2048NoNo
Damaged checksum; verification disabledIgnore02048 / 2048YesYes
Original skippable metadataVerify if present02048 / 2048YesYes
Changed skippable metadataVerify if present02048 / 2048YesYes

Wrong dictionary, successful process: with the checksum absent, the wrong dictionary produced 2,048 bytes and exit code zero, but those bytes differed from the expected payload. Enabling the checksum detected this particular mismatch. This is deliberate misuse, not a newly discovered codec defect or a measurement of checksum collision probability.

Complete frame, incomplete archive: we separately compressed record-one\n and record-two\n, then concatenated the two frames. Removing the second frame left a valid first frame. Decoding succeeded and yielded 11 bytes instead of the intended 22. There was no remaining malformed frame for the decoder to reject. The expected full-stream hash and length exposed the loss.

Complete output, failed process: removing only the final byte from the two-frame stream produced all 22 expected bytes on this build, but the decoder reported premature end and exited with code 1. A pipeline that accepts output while ignoring the producer's status can therefore accept a failed decode. The amount emitted before an error is implementation-dependent; the nonzero status must not be discarded.

The dictionary-free control occupied 2,061 compressed bytes; the dictionary-dependent checked frame occupied 21. That is deliberately contrived reuse, not a compression benchmark. It excludes the 8,192-byte dictionary and says nothing about net savings for a real collection.

Matching dictionary IDs can still return wrong bytes

The earlier cases omit IDs. This separate experiment keeps them: a 2,048-byte formatted dictionary is trained from 128 deterministic synthetic samples with ID 123456. The payload is its final 256 bytes. One variant changes only the ID to 123457; another flips one bit in the dictionary's final content byte while retaining the original ID and entropy tables. These are controlled mutations, not naturally occurring collisions.

Eight synthetic cases on Zstandard 1.5.5. IDs identify a dictionary selection; payload acceptance still requires exit zero and exact bytes. An absent frame ID is displayed as None.
CaseFrame / supplied IDExit codeOutput / expected bytesPayload accepted
Correct dictionary; checksum123456 / 1234560256 / 256Yes
Missing dictionary123456 / None10 / 256No
Changed ID only; no checksum123456 / 12345710 / 256No
Changed content; checksum verified123456 / 12345610 / 256No
Changed content; no checksum123456 / 1234560256 / 256No
Changed content; checksum ignored123456 / 1234560256 / 256No
Correct dictionary; no checksum123456 / 1234560256 / 256Yes
Frame ID omitted; changed dictionary ID onlyNone / 1234570256 / 256Yes

Different label, unchanged coding data: changing only the dictionary ID caused rejection even though the frame had no content checksum. Omitting the frame ID then allowed that renamed dictionary to decode the same payload correctly. ID comparison and content-checksum comparison are separate checks.

Same label, changed coding data: the one-bit content mutation retained the expected ID, but returned a 256-byte payload differing from the expected bytes with exit zero when the checksum was absent or explicitly ignored. Verifying the checked frame rejected this mismatch. The successful controls used the original dictionary with and without a checksum. We did not find or search for a checksum collision.

The dictionary ID is therefore a selection guard, not a content hash or proof of authenticity. The CLI manual assigns responsibility for locally unique IDs to the dictionary manager; RFC 8878 supplies the format, not a dictionary retrieval protocol. [Zstandard CLI] [RFC 8878]

Rotation must preserve older dependencies

Our engineering inference: keep an immutable mapping from each archive generation to the exact dictionary digest. Do not overwrite a dictionary object in place or reuse its ID while retained archives still depend on it. Test recovery with an empty cache and the retained mapping. A trusted digest detects our changed dictionary; a matching numeric ID alone does not. The digest's trusted association matters as much as its algorithm.

This is a deliberately dictionary-dependent input, not evidence of failure frequency, compression quality or a codec defect. The mutation is confined to generated temporary files. Different readers and versions need their own conformance checks.

When both zlib checksums accept the wrong dictionary

A constructed zlib example produces three wrong bytes in a completed 1,049-byte decode even though the dictionary check and decoded-content checksum both pass. The 45-byte compressed stream stays unchanged. This is a dependency-verification limit, not a new codec defect.

In zlib, DICTID is Adler-32 over the preset dictionary. The trailer checks the decoded content, including any bytes copied from that dictionary; it does not separately hash the dictionary object. The API requires the original dictionary, which a matching checksum alone cannot identify. [RFC 1950] [DEFLATE] [Dictionary API]

What the two Adler-32 sums retain

Adler-32 starts with s1=1 and s2=0. For each byte, it adds the byte to s1, then the updated s1 to s2, reducing both modulo 65521. The result is 65536*s2+s1. The trailer stores this value most-significant byte first. [RFC 1950, section 2.2]

For 00 02 00 and 01 00 01, the final sums are s1=3 and s2=7: both give 0x00070003. The arithmetic and native-zlib checks include a single-byte mismatch control. This small worked example explains the existing dictionary experiment below; it is not a frequency estimate. RFC 1950 requires compliant zlib decoders to check ADLER32 and report a mismatch, but performing the check cannot distinguish these colliding inputs. [RFC 1950, section 2.3]

Unused checksum values are not an error-rate model. For 128 bytes, s1 ranges from 1 to 32641, including its initial 1, and never wraps modulo 65521. RFC 3309 discusses the short-packet distribution problem behind SCTP's historical switch to CRC32C. That protocol decision is not a measured archive-corruption rate. [RFC 3309, section 1]

Conversely, all 65536 two-byte inputs have distinct Adler-32 values: with bytes a and b, s1=1+a+b and s2=2+2*a+b, so a=s2-s1-1 and b=2*s1-s2 recover both. The linked checks enumerate that entire fixed-length domain. The three-byte collision above marks the limit of this example, not a contradiction. Neither output width nor unused values alone determine a probability for the errors your system experiences.

Stone and Partridge's SIGCOMM 2000 study likewise distinguishes error patterns that are always detected from those detected probabilistically, and discusses uncertainty when inferring causes from damaged packets. Its network observations are not an Adler-32 experiment or a storage-fleet estimate. [Stone and Partridge, section 6]

One balanced mutation survives two checks

We changed three adjacent dictionary bytes from 100,100,100 to 101,98,101. Both the byte sum and the weighted sum used by Adler-32 stay unchanged: 1 - 2 + 1 = 0 and w - 2(w-1) + (w-2) = 0. In this fixture, backward references copy those adjacent changes into the payload, preserving its checksum too. Both dictionaries have Adler-32 0x232eee3b; both different outputs have 0xb24bf6ed.

Direct C calls on zlib 1.3 accepted the alternate dictionary with Z_OK and finished with Z_STREAM_END. Python reproduced the result at input chunks of 1, 7 and 65,536 bytes; Node's bundled zlib 1.3.2.1-motley-285e94b reproduced the same frozen input. C and Python share the system library. These are eight designed controls, not independent trials or independent codec implementations.

Native C results on the retained zlib 1.3 build. Payload acceptance requires decoder completion and exact expected bytes. Return codes: 0 = Z_OK; 1 = Z_STREAM_END; 2 = Z_NEED_DICT; -3 = Z_DATA_ERROR; -5 = Z_BUF_ERROR. The terminal operation is dictionary setup if setup fails, otherwise inflate.
ControlDictionary returnTerminal returnOutput bytesExact bytesPayload accepted
full-correct011049YesYes
full-alias011049NoNo
full-wrong-id-3-30NoNo
full-missingNot called20NoNo
partial-correct01215YesYes
partial-alias0-3215NoNo
bad-trailer0-31049YesNo
truncated0-51049YesNo

The wrong-ID dictionary fails during setup. The partial-copy control accepts the aliased dictionary but fails the output check: its payload omits one of the three balancing changes. A damaged or truncated trailer can leave all expected bytes in the C buffer without successful stream completion. Ordinary checks remain useful; keep them enabled.

Two checked fields do not automatically give independent evidence. This deliberate collision does not estimate a field failure rate, but multiplying two nominal 32-bit miss probabilities would assume away this coupled error mechanism. Bind exact dictionary bytes and intended output to trusted metadata. Hashing only the compressed file cannot detect this substitution because that file never changed.

Maxino and Koopman's checksum study evaluates specified independent-bit and burst-error models, with outcomes depending on data and codeword length. Our dictionary substitution is a different error process: one selected dependency carries a balanced change into the decoded output. Their network error probabilities cannot be transferred to this constructed case. Use an explicit error model before estimating an undetected-error rate.[Checksum study, sections 3 and 3.5]

All eight controls as JSON / Raw observations and fixture hashes / Primary-source map / Runnable evidence package. The package includes synthetic inputs and C, Python and Node checks; its README separates frozen-input replay from fresh compression. No hardware faults, natural collisions or population failure rates were measured.

A stored checksum is not an executed check

RFC 8878 allows decoders to ignore checksums. Our CLI comparison makes that choice explicit: the same checked frame and wrong raw dictionary failed under --check, but returned wrong bytes and exit zero under --no-check. The frame still contained its checksum. Verification was disabled at read time, not omitted at write time. [RFC 8878]

We also flipped one bit in the final checksum byte of the dictionary-free control, leaving compressed data unchanged. Verification rejected it; ignoring the checksum returned all 2,048 correct payload bytes. This isolates a checksum discrepancy from payload damage. It does not recommend suppressing verification, nor establish that arbitrary damaged files are recoverable.

Correct payload, changed metadata

A skippable frame carries user metadata that a normal Zstandard decoder passes over. We prefixed the checked control with generation=0001, then changed it to the equally long generation=0002. Both streams returned the same 2,048-byte payload with a successful checksum check and identical decoded SHA-256, despite different compressed-stream hashes. This is metadata exclusion, not a hash collision. [RFC 8878]

The table's Payload accepted column intentionally retains the original narrow oracle. It cannot attest to skipped metadata. When such metadata matters, verify it separately or bind the complete stored object to a trusted digest. The existing compressed-object identity check below would detect our mutation; checking only the decoded length and hash would not.

One archive name, different recovered bytes

A correct decompression can still leave an ambiguous file selection. In a TAR containing two regular entries named record.txt, GNU tar restored the last entry to disk but sent both payloads to standard output. Every one of those calls succeeded. The archive bytes remained unchanged.

We constructed four USTAR archives: A then B, B then A, B twice, and a single B. Each payload is 13 bytes. A has modification time 200; B has time 100. Eight reader operations per archive ran on tar (GNU tar) 1.35 and Python 3.12.3. Before reading, each TAR passed an exact gzip compression/decompression round trip. The experiment then used the decoded TAR, isolating member selection from the codec.

Observed payloads, in output order. A+B means 26 concatenated bytes, not a selected version. All operations in these two columns succeeded.
Reader operationArchive A then BArchive B then A
GNU tar: extract to diskBA
GNU tar: extract to stdoutA+BB+A
GNU tar: occurrence 1AB
GNU tar: occurrence 2BA
Python: extractfile(name)BA
Python: first TarInfoAB
Python: loop over TarInfo objectsA+BB+A
Python: loop, re-lookup each nameB+BA+A

Archive order is not modification-time order

GNU tar permits repeated names, including when appending another version. Default extraction processes the entries in archive order, so the later entry replaces the earlier file. [TAR append] In A then B, the observed result was B despite its lower modification time. Reversing the entries produced A. Neither result establishes the application's intended recovery version.

With -xOf, GNU tar concatenates selected members in archive order. [TAR stdout] A pipeline that substitutes standard-output extraction for disk extraction therefore needs a new acceptance check. Even B followed by identical B emitted 26 bytes rather than the required 13; identical duplicate content did not make the two recovery paths equivalent.

A Python inventory can accidentally read the same entry twice

getmember(name) selects the last occurrence; getmembers() retains archive order. Passing a specific TarInfo to extractfile() selects that entry. [Python] Our correct member-object loop read A+B. Replacing its argument with member.name read B+B from the same A-then-B archive. The lengths were identical. An entry-by-entry checker must preserve entry identity, not only its name.

Define the selection rule before restoring

GNU tar's --occurrence=1 and --occurrence=2 selected the respective entries. Requesting occurrence 2 from the single-entry control failed with exit code 2 and empty output. [TAR occurrence] Selecting one occurrence is not a whole-archive integrity check; GNU tar may stop scanning once the requested occurrence is found.

Our engineering recommendation: either reject duplicate names in a format that requires one file per path, or retain archive identity, entry order/occurrence, member type and expected payload digest. Verify the actual restored output against an independently chosen requirement. Here the requirement was exactly B, fixed before creating any archive. A manifest keyed only by pathname can silently lose the distinction between stored entries.

The strict duplicate-name policy rejected all three repeated-name fixtures, including B+B. That is a policy choice, not proof that TAR duplicates are invalid. This check covers literal names only; path normalization, links and filesystem aliases need separate handling. These four designed fixtures do not validate a hostile-archive extractor, metadata restoration or production failure rates.

Reproduction script / 32 operations, full outputs, versions and SHA-256 records / archive-member definition. Only generated files inside a private temporary directory are extracted. The runner accepts no external archive and refuses an existing result file.

python3 tar-member-selection.py --output members.json

In our intact target-first TAR, selecting alias into a directory with an old target completed without error in GNU tar 1.35 and both tested Python builds. The alias then contained the old bytes. Both generations were 29 bytes long: existence, size and completion checks all passed, but the required content did not.

GNU tar generated five benign USTAR fixtures; each underwent eleven operations. The table shows the target-first fixture: a regular target followed by a payload-free hard-link entry alias. Each operation used a fresh disposable directory, with a stale or matching target seeded only where specified. Python disk extraction explicitly used filter="data" and errorlevel=2.

Target-first fixture. Completion and correct payload are separate observations. No alias means no selected disk file; a dash means that file identity does not apply.
Operation / destinationCompletedSelected bytesShares target file
GNU tar: full restore, emptyYesExpectedYes
GNU tar: alias, emptyNonzero statusNo alias-
GNU tar: alias, stale targetYesStaleYes
GNU tar: alias, matching targetYesExpectedYes
GNU tar: alias to stdoutYes0 bytes-
Python: full restore, emptyYesExpectedYes
Python: alias, emptyYesExpected-
Python: alias, stale targetYesStaleYes
Python: alias, matching targetYesExpectedYes
Python: seekable extractfileYesExpected-
Python: streaming extractfileStreamErrorNo alias-

Destination state is part of the read contract

GNU documents the dependency of selected hard-link extraction on its target. [GNU hard links] Python's pinned implementation first tries an existing disk target; if absent, it can copy the earlier archive member. Its seekable extractfile resolves archive content, while the streaming link path raises StreamError. That explains the measured contrast, without promising the same behavior for every reader. [Pinned implementation]

Overwrite protection is a different requirement. In twelve additional GNU tar 1.35 controls, full extraction over a stale target with --skip-old-files returned status 0 while the alias shared stale bytes; --keep-old-files returned status 2 with the same stale payload. Selecting only the alias returned status 0 with stale bytes under both options and the default policy: no target overwrite was attempted. Empty-destination full restores succeeded; alias-only restores failed. These are synthetic cases on one binary, not a failure-rate estimate. [GNU policy] [Twelve controls]

Equal payloads do not preserve shared-file identity

Reversing input order made alias the payload-bearing entry. Archiving only that name also made it self-contained. With --hard-dereference, both names carried regular payloads: full restoration returned correct bytes but separate files. After normalized metadata, this archive was byte-for-byte identical to one made from independent equal-content source files. Inference: these archive bytes alone cannot recover the discarded sharing relation. Per-path hashes are insufficient for that requirement.

Zwicky's LISA 2003 study compared restored content and metadata separately and highlighted encounter order for hard-linked names. Its operating-system selection was pragmatic, not a random sample. We use that methodological lesson, not its historical results as a modern reliability estimate. [LISA paper]

Recovery rule: use isolated staging, restore required link targets and check the expected generation. If shared-file relationships matter, verify them separately using live device/inode pairs; equal hashes do not establish sharing. Our write-through probe runs only on disposable fixtures, never on a real backup.

The 55 configurations were replayed on CPython 3.12.3 and 3.12.15 with one GNU tar 1.35 binary on one Linux host. These are not independent reliability trials, a security audit or a newly discovered vulnerability. ACLs, xattrs, hostile paths, crashes and throughput are outside scope. The reproduction bundle contains code, tests, provenance and complete observations; raw JSON is also available. See archive member and hard link.

A successful selected read can miss damage elsewhere

In a separate three-fixture experiment, --occurrence=1 returned the correct first file with exit zero even when a later header was damaged. Reading the same named file without that option returned the same bytes but exited with code 2. GNU tar documents that occurrence selection can finish before scanning the rest of the archive. [TAR occurrence]

Each 10,240-byte USTAR contains two distinct regular files: record.txt holds first plus a newline, and tail.txt holds later plus a newline. Starting from the intact control, we independently flip bit 0 at byte offset 1,024 (the later header's filename) or 1,536 (the later payload). The header checksum is left unchanged. Four reader commands run on each plain TAR with tar (GNU tar) 1.35; there is no compression wrapper in these twelve operations.

Each cell shows exit code and stdout. Text outputs include a final newline; Empty means zero bytes. List outputs are filenames, not verified payloads.
FixtureFirst file, occurrence 1First file, defaultList allLater file, default
Unchanged control0
first
0
first
0
record.txt + tail.txt
0
later
One bit in later header0
first
2
first
2
record.txt
2
Empty
One bit in later payload0
first
0
first
0
record.txt + tail.txt
0
mater

Listing all names still leaves payloads unchecked

The payload mutation changed later to mater without changing its length or either header. All four commands exited zero, including the full listing; extracting tail.txt returned an incorrect six-byte payload. The USTAR checksum covers the header, not the file contents. [TAR format] Comparing the actual output against the independently retained expected payload rejected this result.

These controls separate selection scope from checksum scope. Removing early completion exposed our bad header, but did not turn listing into a content verifier. Checking the first file's digest would still miss damage to the other file. A trusted digest of the complete TAR detected both mutations; a new digest calculated only from the received archive would not establish that it was the intended original.

Practical rule: record what was checked: one selected member, archive structure, every required member's content, or the complete stored object. Require successful commands and compare against an independently retained manifest at the intended scope. A selective restore is useful; do not report its success as a completed whole-archive validation.

This measures outcomes on one GNU tar build, not physical read coverage: buffered reads may fetch bytes that are never validated. Compressed-input behavior, hostile paths, links and metadata restoration need separate tests. Download the bounded reproduction script and twelve complete results with mutation offsets and hashes.

python3 tar-read-coverage.py --output coverage.json

Gzip can finish while TAR stops at the first archive

Joining two .tar.gz byte strings preserves a valid sequence of gzip members, but also preserves the first TAR's end marker. In this experiment, gzip checked and decoded every compressed member correctly; default TAR readers then returned only the first of three intended files, without an error. Compression completion and container coverage are separate conditions. [Gzip concatenation] [TAR concatenation]

The fixed recovery target is alpha.bin with 17 A bytes, beta.bin with 513 B bytes and gamma.bin with 31 C bytes: 561 bytes in total. Eight fixtures run six reader operations each on tar (GNU tar) 1.35, gzip 1.12 and Python 3.12.3. Every fixture first passes gzip -t and complete decompression, with exact comparison to the constructed TAR. The table shows payload reads; separate name listings and all diagnostics are in the JSON.

Returned payload bytes and API status. GNU columns use stdout extraction; Python columns sum fully read entry payloads. OK means exit 0 or no exception, not a passed recovery check. The zero-payload control expects 1,056 bytes; all others expect 561.
FixtureGNU defaultGNU -iPython defaultPython ignore_zeros
Combined TAR control561 bytes
OK
561 bytes
OK
561 bytes
OK
561 bytes
OK
Joined TARs, one gzip member17 bytes
OK
561 bytes
OK
17 bytes
OK
561 bytes
OK
Joined .tar.gz byte strings17 bytes
OK
561 bytes
OK
17 bytes
OK
561 bytes
OK
One zero block between entries17 bytes
OK
561 bytes
OK
17 bytes
OK
561 bytes
OK
Final zero markers removed561 bytes
OK
561 bytes
OK
561 bytes
OK
561 bytes
OK
Middle header checksum invalid48 bytes
Error
48 bytes
Error
17 bytes
OK
48 bytes
OK
Entire middle member removed48 bytes
OK
48 bytes
OK
48 bytes
OK
48 bytes
OK
512 zero bytes inside alpha1,056 bytes
OK
1,056 bytes
OK
1,056 bytes
OK
1,056 bytes
OK

Where the zeros occur matters

One gzip member wrapping two terminated TARs and two gzip members wrapping those TARs separately produced identical decoded TAR bytes. Both default readers stopped after alpha; their continuation modes reached all three files. A single zero block between entries also stopped default reading. GNU tar printed a warning but still exited 0. In contrast, a 512-byte zero-filled alpha payload survived intact: zeros inside an entry are data, not an archive boundary. Removing all zero blocks is not a safe repair.

GNU tar documents stopping at zero blocks and the explicit --ignore-zeros continuation option. Its --concatenate operation removes a target archive's end marker; raw byte concatenation does not. That operation is not a validator of the supplied archives, and the documented compressed-archive restrictions still apply. [GNU tar] [Concatenate]

Salvaging more files can still report incomplete recovery as OK

A one-bit change in beta's header, with its stored checksum left unchanged, produced a different split. GNU tar recovered alpha and gamma but exited 2 with both options. Python default returned alpha without an exception; ignore_zeros=True returned alpha and gamma without an exception. Its documented policy skips invalid blocks as well as zero blocks. The pinned TarFile.next() implementation also treats an invalid later header differently from an invalid initial header, which the negative control rejects. [Python policy] [Implementation]

Deleting beta's entire member left a structurally readable archive. Every reader completed successfully, yet every independent content comparison failed. Removing only the final zero markers gave all expected files on these builds. Thus neither a successful parse nor a missing terminator alone determines whether the required recovery content is present.

Recovery implication: preserve an independent inventory and per-entry content expectations, apply an explicit trailing-data policy, and distinguish salvaged output from an accepted restore. More permissive parsing can expose later files; it cannot establish that skipped or absent files were unnecessary. Do not promote partial output just because a reader returned normally.

Check the expected set, not just the files that survived

A loop that verifies every returned file can still accept an incomplete restore: every surviving digest may match while beta is absent. Our payload acceptance example requires explicit reader completion, the exact expected set of literal names, no duplicates, and matching sizes and SHA-256 digests. It derives 16 decisions from the retained Python observations; nine satisfy that narrow policy, seven do not. These are designed cases, not a reliability rate. Policy regression tests include complete output from a failed reader and malformed records.

The expected inventory is fixed before parsing. Rebuilding it from surviving files defeats the check. A pass here says nothing about metadata, safe extraction, unparsed trailing data or authenticity; it is not a TAR-format validation result. BagIt 1.0 makes a related distinction: completeness requires the specified files and manifest coverage; validity additionally requires checksum verification. RFC 8493 is Informational and leaves protection against active attackers to additional measures. Our example is not a BagIt implementation. [BagIt]

Why compare restored state?

Elizabeth D. Zwicky's LISA 2003 study generated filesystem edge cases, ran backup/restore pairs, then compared content and metadata separately. It exercised names, links, permissions and sparse files on RedHat Linux 8.0/ext2, FreeBSD 4.8/UFS and Solaris 5.9. The systems were selected for availability and popularity, not as a representative population. Its useful lesson is methodological: test the actual version, options and environment. Its historical defects do not establish modern failure rates, and our payload-only experiment does not reproduce its filesystem tests. [LISA 2003, pp. 7-10, 13]

Run the bounded harness, inspect all 48 reader observations, and use the 11 regression tests and method and source review. No existing archive or disk extraction is used. Mutations occur before gzip compression, so valid gzip checks correctly cover the altered TAR; this is not gzip missing transport corruption. These version-scoped observations test neither hostile archives nor metadata restoration, compression read-ahead, crash durability or failure frequencies.

A missing incremental can leave plausible old files

In our GNU tar 1.35 fixture, base plus tail restored every expected filename at its expected size and returned zero, but one file still held the base generation. The omitted middle archive contained that file's only update. A successful extraction did not establish a complete recovery chain.

The external .snar snapshot selects changes for --listed-incremental creation and is updated by that operation. Extraction uses embedded archive metadata; it does not require that snapshot. In a directory's dumpdir record, N records a present but unchanged name whose payload was omitted. That name alone cannot repair stale destination bytes. [GNU manual] [Dumpdir format]

We declare three source generations before archiving. The middle changes two eight-byte files and removes a third; the tail changes only one of those two. Seven archives support nine restore procedures, each in an empty temporary directory. All external snapshots are deleted before restoration. Two retained captures agree, and publication review repeated the same native experiment; these are repeatability checks on one host.

Nine designed procedures, not failure-rate samples. All 33 creation, listing and extraction commands per capture returned zero. Exact content includes the expected absence of deleted names. Both retry rows target generation 1; all others target generation 2.
Recovery procedureNames matchSizes matchExact contentDifference
Base, middle, tailYesYesYesNone
Base, tail: middle omittedYesYesNoStale: data/revised.txt
Base, tail, middleYesYesNoStale: data/recent.txt
Tail onlyNoNoNoMissing: data/revised.txt, data/stable.txt
All three; plain extractionNoNoNoExtra: data/retired.txt
Base, generation-2 fork from base cursorYesYesYesNone
Base, retry from advanced cursorYesYesNoStale: data/recent.txt, data/revised.txt
Base, retry from saved base cursorYesYesYesNone
Fresh full backupYesYesYesNone

Retrying from the advanced cursor does not replace the missing archive. With the generation-1 source unchanged, that retry emitted directory metadata but no regular-file payloads. Restoring it after the base left both changed files stale. Retrying from the saved base cursor re-emitted them. A generation-2 fork from that same base cursor also recovered the intended state with just two archives. Dependency identity, not the number of archives, determines the required recovery set.

Plain extraction retained the deleted file; incremental extraction removed it. Restore drills therefore need an isolated destination. The saved-cursor controls used quiescent source generations: an old cursor cannot recreate historical bytes that no longer exist. We withheld a successfully created archive at restore time, not during an injected upload or creation failure.

Maheshwari, Vingralek and Shapiro's TDB design (OSDI 2000, sections 6.2-6.3) makes the distinction explicit: backup descriptors identify the source, base snapshot and backup set; restoration checks predecessor identity and set cardinality before committing. Its checksum for transfer completeness is separate from that lineage check. This is a design comparison, not a TDB replication or a recommendation of its historical cryptography. [TDB paper]

Source consistency is a separate obligation. TDB first snapshots the source partitions in one atomic commit before copying them (section 6.1). Our tar inputs were quiescent; correct predecessor selection does not demonstrate application consistency under concurrent writes. The paper measures only backup creation in section 9.2.3, so it supplies no restore-time benchmark here. [TDB paper]

Retention follows dependencies, not dates. In this fixture, keeping the base and tail is insufficient, while keeping the base and its generation-2 fork is sufficient. A count of two intact archives therefore cannot identify an acceptable recovery set. Retain every actual predecessor needed by a promised recovery point; an older archive is not redundant merely because a newer one exists. This is an inference from the controlled cases, not a claim that every incremental format requires replaying all earlier backups.

Engineering inference: keep the accepted selection checkpoint associated with its retained recovery generation. Create a candidate with a working copy; validate archive identity, actual predecessor dependencies and restored state before promoting that cursor. A real implementation still needs crash-safe persistence and concurrency control. This experiment does not supply such a wrapper, a failure frequency or a power-loss guarantee.

Inspect the generated results, method and reproduction guide, or code and retained captures. The fixture covers short regular-file names, not renames, links, ACLs, concurrent writers or hostile archives. Continue with incremental backup and backup verification versus restore testing.

All expected bytes can arrive before gzip reports a bad trailer

In our gzip experiment, reading exactly the expected payload length and closing the reader returned every correct byte without an error, even with a damaged checksum or incomplete trailer. Continuing until end-of-file exposed the error. A byte-count target is not the same operation as finishing the decoder.

We generated A (65,536 bytes) and B (32,768 bytes) independently of the compressed inputs. Seven fixtures include clean controls, a one-bit CRC32 mutation, one missing final size byte, two concatenated members, deletion of the entire second member and eight trailing non-gzip bytes. Six operations per fixture ran on CPython 3.12.3 with zlib 1.3. The required output is A for single-member fixtures and A+B for all others.

Each cell shows API outcome and bytes returned to the caller. OK is not an integrity verdict. Exact-length reads include close; EOF reads continue in 4,096-byte chunks until empty output or an exception. All returned bytes shown here matched the corresponding expected prefix.
FixtureExpected bytesRead expected length; closeRead through EOFzlib single-member call
Single member, clean65,536OK
65,536 bytes
OK
65,536 bytes
OK
65,536 bytes
Single member, CRC bit flipped65,536OK
65,536 bytes
Error
65,536 bytes
Error
0 bytes
Single member, final size byte missing65,536OK
65,536 bytes
Error
65,536 bytes
Error
0 bytes
Two members, clean98,304OK
98,304 bytes
OK
98,304 bytes
OK
65,536 bytes
Second member CRC bit flipped98,304OK
98,304 bytes
Error
98,304 bytes
OK
65,536 bytes
Entire second member removed98,304OK
65,536 bytes
OK
65,536 bytes
OK
65,536 bytes
Two members plus non-gzip suffix98,304OK
98,304 bytes
Error
98,304 bytes
OK
65,536 bytes

Close does not finish validation on a read handle

The bad single-member CRC and missing-trailer-byte fixtures both returned 65,536 correct bytes from the exact-length read and closed without error. The EOF loop also returned those bytes, then raised BadGzipFile or EOFError on a later read. The whole-buffer gzip.decompress() call raised without returning a result. These are different caller-visible output contracts, not different original payloads.

In the pinned CPython source, read-mode close closes the buffer; trailer checking belongs to the read path. Our successful 16-byte prefix reads also did not expose any of the later damage. Internal read-ahead is not a validation receipt. These observations depend on the tested call sizes and implementation; they do not promise that every partial read defers every possible error. [CPython source]

A completed member is not a completed gzip file

zlib.decompress(input, wbits=31) returned only A from the intact A+B input: 65,536 of the required 98,304 bytes. The object-based equivalent reported eof=True but retained 32,796 compressed bytes in unused_data. The same first-member success hid a bad CRC in member B. zlib's underlying inflate interface stops at a member boundary; the caller must handle subsequent members. Python's gzip decoder supports concatenated members. [zlib 1.3] [Python gzip]

The inverse trap appeared with the truncated single member: decompressobj().decompress() followed by flush() returned all 65,536 bytes without an exception, but eof remained false. An empty unused_data did not prove completion. Record the terminal state as well as output and exceptions. Python distinguishes unused post-stream input from unconsumed_tail, which is input retained because of an output limit. [Python zlib]

Even a fully checked surviving member cannot prove nothing was deleted

Removing B completely left the same valid input bytes as the single-member control. Every whole-input decoder completed successfully, yet returned only A against the separately fixed A+B requirement. No damaged member remained to reject. The expected length and digest detected the omission; a newly calculated checksum of the surviving object would not establish its original identity.

RFC 1952 describes a gzip file as a sequence of members, with a CRC32 and uncompressed size modulo 232 in each trailer. Those fields are not a trusted inventory of the originally intended members. Its minimum decompressor requirements also do not make every trailer field mandatory to check. The measured Python behavior above is stronger, implementation-specific evidence, not a claim that a format name guarantees validation. [RFC 1952, sections 2.2 and 2.3.1]

Recovery rule, inferred from these controls: use a decoder that processes the intended member sequence, propagate read and terminal errors, and compare the complete output with independently retained expectations before publication. For a low-level zlib loop, account for both end-of-member state and remaining input; do not replace multi-member processing with a blanket rejection of all remaining bytes. Define any padding policy separately. The trailing-garbage result here covers exactly NOT-GZIP, not zero padding or every possible suffix.

The standard-library reproduction script and 42 observations with hashes and runtime identity complement the gzip corpus entry. Only bounded synthetic in-memory data are decoded. This is not a corruption rate, performance benchmark, security audit or newly discovered library defect. Counts of returned bytes exclude bytes produced internally by a call that raised.

python3 gzip-read-coverage.py --output gzip-results.json

Gzip listing size and CRC can describe different scopes

GNU gzip 1.14 counts decoded bytes across members, but its displayed CRC still belongs to the last member. A correctly counted length is not a checksum of the complete recovery object. Older versions also differ in their size reporting.

We tested eleven synthetic fixtures through GNU gzip 1.11, 1.12 and 1.14, each as a named file, redirected regular-file input and a real pipe: 99 listing observations. The table selects named-file results. A contains 4,096 bytes, B contains 17; the large single member decodes to 4,294,967,313 zero bytes (4 GiB + 17). Values are generated from the retained observations.

Successful GNU gzip -lv listings. All sizes are bytes; A+B and A+B+empty both decode to 4,113 bytes. These are designed controls, not a statistical sample.
FixtureGNU gzipListed size (B)
A+B1.1117
A+B1.1217
A+B1.144,113
A+B+empty1.110
A+B+empty1.120
A+B+empty1.144,113
4 GiB + 17 B1.1117
4 GiB + 17 B1.124,294,967,313
4 GiB + 17 B1.144,294,967,313

On a pipe, the tested 1.11 build instead reported unknown sizes (-1) and exited zero. Redirecting a regular file to standard input is still seekable and is not the same control. Unknown is neither zero nor an unsigned capacity.

The format field does not determine what a tool can count

Each member stores ISIZE modulo 232, but a decoder can count more bytes and sum across members. GNU 1.14's release notes record the multi-member listing fix. Its implementation retains an aggregate output counter while checking each trailer against that member's output. The bundled manual still states that listed size applies only to the last member: a documentation inconsistency in this exact release, resolved here using source inspection and executable controls. [RFC 1952] [GNU release notes] [Pinned release source]

Equal listing fields do not identify equal output

Appending an empty member changes the 1.14 displayed CRC from 0e76bab7 to 00000000 without changing the decoded bytes or total size. More strongly, correctly recompressing a changed first member leaves all numerical listing fields identical to the original: compressed size, decoded size, ratio and displayed CRC. Both full decodes succeed, but their whole-output SHA-256 digests differ. This is a scope mismatch, not a CRC collision.

Recovery consequence: budget actual decoded output, retain terminal decoder errors, and compare against independently recorded expectations for the intended version. GNU 1.12 and 1.14 perform decompression during listing, so listing can already do the work an output budget is meant to constrain. Removing an entire valid member also requires an external inventory or content expectation to detect the omission.

The reproduction packet contains fixtures, code, tests, source hashes and both retained matrices; the 99-row JSON matrix is also directly available. Full replay streams the 4 GiB case without storing expanded output, but still consumes decompression CPU and reads all output. The reproduction guide separates offline evidence checks from native replay.

These are same-host, version-bound controls, not independent peer replication, a performance benchmark or an arbitrary-input security validator. GNU 1.13, later releases, other platforms, metadata restoration and crash durability were not tested. The gzip record retains the format and reader-completion distinctions.

Which gzip checks did the reader actually perform?

Correct decoded bytes do not establish header validation. In a separate experiment, CPython 3.12.3 returned the complete expected payload from headers with a deliberately stale checksum. The tested gzip-aware zlib 1.3 and GNU gzip 1.12 paths rejected the same input.

The data trailer covers the decoded payload, not header metadata such as the timestamp, optional filename, comment or extra fields. Optional FHCRC stores the low 16 bits of the header's CRC32. RFC 1952 permits a decompressor to skip this check, but separately requires an error for nonzero reserved flag bits. Those are different acceptance requirements. [RFC 1952, sections 2.3.1 and 2.3.1.2]

Twenty synthetic header/input fixtures and fourteen separate flag controls were each tested through seven operations: 238 observations per capture. Metadata mutations leave compressed data and the data trailer unchanged. Reserved-bit controls recompute FHCRC where present, so a stale header checksum cannot explain their rejection. Expected payloads were fixed before encoding.

Selected native observations, not failure frequencies. Python uses whole-buffer gzip.decompress; zlib uses gzip-aware single-member decoding. GNU uses gzip -dc. OK means API or process success, not acceptance of the original stored object. Each selected fixture expects 257 decoded bytes.
InputPython gzipzlibGNU gzip
Unchanged headerOK; 257 bytesOK; 257 bytesOK; 257 bytes
Timestamp changed; stale FHCRCOK; 257 bytesError; 0 bytesError; 0 bytes
One FHCRC bit changedOK; 257 bytesError; 0 bytesError; 0 bytes
Name changed; FHCRC recomputedOK; 257 bytesOK; 257 bytesOK; 257 bytes
Reserved bit 0x20; valid FHCRCOK; 257 bytesError; 0 bytesError; 0 bytes
FTEXT control; valid FHCRCOK; 257 bytesOK; 257 bytesOK; 257 bytes
Payload CRC bit changedError; 0 bytesError; 0 bytesError; 257 bytes

The read-through-EOF Python path agreed with its whole-buffer path. Its pinned parser discards FHCRC and delegates raw DEFLATE decoding to zlib; zlib's gzip-aware parser instead checks the header. Saying that both use zlib does not identify the wrapper checks. In the timestamp control, Python returned MTIME 2 instead of the original 1 while preserving every payload byte. [CPython parser] [zlib parser]

Recomputing FHCRC after changing the filename restored success in every tested operation without restoring the original header. That is checksum recalculation, not a collision or authentication. Separately, Python accepted each reserved bit and their combination; the tested zlib and GNU paths rejected them even with a valid FHCRC. FTEXT controls passed and an invalid compression method failed everywhere. These observations are version-scoped, not certification of a general validator.

A zero return or successful close can hide an earlier failure

Native gzread() exposed another distinction. With a stale header CRC, gzread() returned -1; gzerror() reported Z_DATA_ERROR (-3), followed by gzclose() returning Z_OK (0). The read return and the zlib error code are different values. A truncated trailer returned all 257 expected bytes and eventually a zero read, while gzerror() and close reported -5. Preserve read failures and inspect terminal status before closing; close frees the state. [zlib API]

The same native file API intentionally accepted plain input and ignored the tested NOT-GZIP suffix. Its transparent-reading policy is documented, not proof that the input was a complete gzip object. A single-member decoder also leaves subsequent members for its caller. [gzread implementation]

Recovery implication: specify wrapper and member coverage, required header checks, allowed suffixes and independent payload/metadata expectations separately. A trusted whole-object hash can bind the stored encoding; a trusted manifest can bind selected semantic fields. Neither can be replaced by the digest of decoded bytes when the disputed change exists only in the header.

Download the reproduction package, 140 header/input observations, 98 flag observations and environment comparison. A new same-host replay preserved all fixture bytes and outcomes after kernel and libz-binary changes; the original captures remain intact. These are designed software controls, not a field-risk estimate, a new vulnerability claim or a filesystem-metadata restore test. The gzip record provides the structured summary.

Matching results and matching environments are separate checks

A version label is not a binary identity. For a historical replay, preserve the original captures, compare inputs and observed behavior first, and report interpreter, library and platform differences separately. Compare the inventory too: a missing environment field is not an unchanged value. Matching these fixtures does not certify other inputs or prove that unrecorded runtime state stayed constant. VXA's warning about testing a native decoder while leaving the archived fallback untested illustrates the broader problem: the exercised recovery path matters. This is an engineering inference from the recorded experiment and VXA section 2.3, not a VXA replication or a guarantee of future compatibility. [VXA, section 2.3]

ZIP validation can lose entry identity and failure status

NPZ adds an array-reader boundary even when member names are unique. A NumPy archive opened and returned its intact first array while another member retained a CRC error; accessing that second array exposed it. See the NPY/NPZ interpretation experiment for selected-read coverage, changed headers and metadata omitted before hashing. This is separate from duplicate-name ZIP selection.

On the tested CPython 3.12.3 build, testzip() returned None for an archive with a damaged first entry and an intact second entry carrying the same name. Reading the first entry by its ZipInfo object raised a CRC error. This reproduces the already reported CPython issue 156539; it is not a new defect discovered by Hesela.

Six two-entry fixtures isolate the behavior. Each payload is 13 bytes, either generation=A or generation=B followed by a newline. Entries use ZIP_STORED, so there is no compression layer. A damaged fixture flips one bit in a selected payload while retaining both stored CRC fields and the rest of the archive. Distinct names, clean duplicates, a damaged last duplicate and reversed order provide controls. Header layout and CRC field locations follow [ZIP APPNOTE, sections 4.3.7 and 4.3.12].

Measured on CPython 3.12.3. Entry checks open each ZipInfo and consume its payload. None is the helper's no-error result, not an independent recovery verdict.
FixtureEntry 1 / entry 2 CRCtestzip() resultCLI reports corruptionCLI exit
Distinct names, cleanPass / PassNoneNo0
Distinct names, first damagedFail / Passfirst.txtYes0
Duplicate name, A then BPass / PassNoneNo0
Duplicate name, first damagedFail / PassNoneNo0
Duplicate name, last damagedPass / Failrecord.txtYes0
Duplicate name, B then APass / PassNoneNo0

A filename lookup can check the same entry twice

The pinned implementation walks its entry list, but opens each element by filename. Its name lookup retains the last matching entry, so the earlier duplicate's bytes are skipped. Passing the actual ZipInfo retains entry identity, as the API permits. [CPython implementation] [Python API]

In the clean A-then-B control, the entry-object loop read A then B; the name-relookup loop read B twice. Reversing archive order changed the name-loop result to A twice. For the damaged-first-duplicate case, the object loop found the error while the name loop returned two intact B payloads. Identical output length therefore did not establish coverage of both entries. This is the same identity loss seen in the earlier TAR experiment, now inside a validation helper.

A printed failure may still have exit status zero

Each fixture also ran through a fresh python -I -m zipfile -t process. For both the damaged unique entry and damaged last duplicate, the CLI printed a corruption diagnostic and then Done testing, yet exited with status 0. An exit-code-only backup gate would accept all six invocations. That is separate from the duplicate-entry bug: even a detected error did not reach the process status on this build. The pinned CLI source confirms this control flow. [CLI implementation]

Keep three decisions separate

  1. Coverage: enumerate entries and read each specific ZipInfo to completion. Do not turn the object back into a name. Propagate read errors and unsupported formats as failed or incomplete validation.
  2. Recovery identity: reject duplicate names when the backup contract requires one file per path. Otherwise bind the intended occurrence to the stored archive and an independent manifest. A clean CRC does not decide whether A or B is the required generation.
  3. Failure propagation: make the automation's success criterion explicit and test it with deliberately damaged input. Neither a printed completion message nor a zero status from this particular CLI is sufficient.

The harness downloads nothing, accepts no external archive and extracts no files. It records exact payloads, archive hashes, mutation offsets, diagnostics, runtime version and source hashes. These observations apply to the measured build, not every Python release or ZIP reader; upstream fixes require rerunning the controls. Compressed, encrypted and ZIP64 entries, path aliases, extraction safety and adversarial archives are outside this experiment.

Format context: ZIP archive and archive member. Run the bounded experiment or inspect the machine-readable observations.

A ZIP rejection is not destination rollback

A correctly detected error can still leave a damaged destination. On the recorded CPython 3.12.3 POSIX build, a CRC-rejected 257-byte member left an existing verified file empty; a 131,089-byte member left 131,072 bytes of its prefix. A local-header name mismatch raised the same BadZipFile class but preserved that target's previous 33-byte payload. The failure phase, not the exception class alone, determined what had already changed. [Native evidence]

We crossed three scenarios, two payload sizes, three conditions and direct/isolated extraction: 36 designed cases. The scenarios replace a preexisting target, place ./target.bin after an earlier target.bin, or place a distinct before.bin first. A later after.bin reveals whether extraction continued. Central-directory names are unique, and each entry is also read through its specific ZipInfo; this is separate from the preceding name-relookup experiment.

Six preexisting-target/direct controls selected from the 36-case matrix. The destination initially contains 33 verified bytes. Rows are generated from retained observations; byte counts are not a failure-rate estimate.
ConditionMember bytesDestination bytes after callPrevious target retainedLater member extracted
Clean control257257NoYes
Payload CRC rejection2570NoNo
Local-header rejection25733YesNo
Clean control131,089131,089NoYes
Payload CRC rejection131,089131,072NoNo
Local-header rejection131,08933YesNo

Mechanism: the pinned extractor opens the archive member, opens the destination in overwrite mode, then copies data. Header-name rejection happens at the first step. CRC rejection occurs while reading the member to its end, after earlier chunks may have been written. With the measured 65,536-byte copy buffer, the short failed read returned no chunk; the larger member supplied two chunks before rejection. These lengths depend on the tested stored-data reader and buffering, not on a universal ZIP rule. [ZIP implementation] [Copy loop]

Identity and time interact. In the alias case, the later rejected member destroyed the earlier recovered target at the shared path. In the distinct-name case, before.bin remained after either failure, while after.bin was never extracted. Preserving one target is therefore not archive-wide rollback. This connects the destination-identity problem to the output-publication boundary.

Engineering inference: keep extraction away from the last good copy until payload verification, expected-inventory checks and destination-name mapping checks pass; define commit separately. All isolated controls preserved the original byte/name inventory because they never wrote there. Even clean staging results were never promoted: this tests isolation, not an atomic or crash-safe publication protocol.

Why promotion needs its own evidence. Pillai et al.'s OSDI 2014 study used ALICE to construct crash states from application system-call traces and check application invariants under explicit persistence models. Its discussion of safe rename distinguishes namespace replacement from the ordering of file-data persistence. That historical study motivates a separate crash-consistency review; it neither tested this ZIP extractor nor validates a particular restore-promotion protocol. [ALICE, sections 3 and 4.4]

Two original captures and a fresh same-host replay agree. These are deliberate counterexamples on one build, not independent replication or incident frequencies. We did not test compression, encryption, ZIP64, hostile paths, symlinks, concurrency, metadata preservation or crashes. Read the method and environment lock, inspect the machine-readable summary and download the complete reproduction package. Related corpus: ZIP archive and restore test.

XZ: a printed checksum is not a verified payload

Detailed XZ listing can print an unchanged CRC64 and decoded size after payload damage. Our unchanged file and one-bit payload mutation produced byte-identical xz --robot --list -vv output, but full testing rejected the mutation. The pinned listing implementation reads the stored Check field; this path does not decode the block to recompute it. [XZ listing source]

We generated distinct 256-byte payloads A and B, encoded each with CRC64 and A separately with no payload check. Nine synthetic fixtures compare four reader operations on XZ Utils/liblzma 5.4.5. Each process uses one thread; the runner verifies its single literal LZMA2 chunk layout before changing one bit. This is a controlled counterexample set, not a sample of naturally occurring failures.

Nine designed cases on one Linux host. Exit 0 means process success; 1 means error on the recorded build. Exact match compares the entire decoded output with A or A+B, independently retained before mutation. Listing and test output are not recovered payload.
Controlled inputList exitTest exitDecode exitOutput / expected bytesExact match
CRC64, unchanged000256 / 256Yes
CRC64, payload bit changed011256 / 256No
CRC64, stored-check bit changed011256 / 256Yes
Stream-header CRC bit changed1110 / 256No
No payload check, unchanged000256 / 256Yes
No payload check, payload bit changed000256 / 256No
Two CRC64 streams A+B000512 / 512Yes
Same streams reordered B+A000512 / 512No
Second stream removed000256 / 512No

Present, supported and actually checked are different

With Check=None, the changed literal payload passed full testing and decoded to the wrong 256 bytes. With CRC64, it failed ordinary decoding but returned the same wrong bytes with exit zero under explicit --ignore-check. A separate stream-header CRC mutation still failed with that option. Conversely, changing only the stored data-check bit produced all correct payload bytes but a failed final status. Consumers must retain both output identity and terminal validation status; these controls do not justify suppressing errors in a real recovery. [XZ manual]

Check presence alone also does not establish decoder support. The liblzma API provides LZMA_TELL_NO_CHECK and LZMA_TELL_UNSUPPORTED_CHECK notifications; a caller requiring verified data must handle them. Unsupported-check builds are a documented boundary, not an experiment performed here. [Decoder policy]

Valid stream checks do not bind the intended sequence

Reordering complete CRC64 streams from A+B to B+A preserved stream count, total decoded length and successful checks, yet changed the intended 512-byte output. Removing the second whole stream also left a valid file, now returning only 256 bytes. These are not checksum collisions: each surviving stream still checks its own unchanged content. XZ framing and indexes do not supply our external assertion that this backup must contain A followed by B. [Format sections 2, 3.4 and 4]

Engineering inference: bind the intended generation to an independently retained full-content expectation, complete the required decoding and checks, and propagate failures before accepting output. A checksum printed by an inspector is not evidence of comparison. A backup manifest reconstructed from surviving streams cannot establish what was meant to survive.

Streaming callers must define completion

The documented liblzma 5.4.5 streaming API adds a caller obligation: with LZMA_CONCATENATED, lzma_code() cannot report LZMA_STREAM_END until the caller uses LZMA_FINISH. Supply that action when no further input will arrive, then continue until completion or an error. A filled output buffer is not the completion signal. Check-type notifications identify the available policy; they do not announce a completed payload comparison. These are API requirements from the pinned header, not additional native cases in the table. [Decoder flags]

Completion also has a scope. In XZ for Java 1.10, SingleXZInputStream stops after one XZ stream, leaving following input unread; XZInputStream processes concatenated streams to input end or error. Both document an extra read() after the expected decoded length: require -1, not merely a full buffer, so footer processing can finish. A short positive read can precede a pending exception on the next non-empty read. [Single-stream API] [Complete-file API]

For an embedded stream, its end can be the intended boundary. For a standalone backup file, that same boundary can leave later streams unexamined. Choose the reader for the intended scope, keep check verification enabled, and still compare with the independent content expectation. This is source review of the Java APIs, not a Java execution or an extension of the native table.

Ask where in the data lifetime verification happens

Zhang and colleagues' End-to-end Data Integrity for File Systems: A ZFS Case Study (FAST 2010) used disk and memory fault injection on a historical Solaris/ZFS configuration. Their block-lifecycle analysis distinguishes checksum generation, disk-read verification and later cached use; compression also changes the protected representation. [Sections 4.2, 5.1.2 and 5.3]

The useful comparison is methodological: identify the bytes, operation and point in time that a check covers. Our XZ listing controls are not a reproduction of that filesystem study, and its results are not current OpenZFS or XZ failure-rate estimates. Neither study turns the mere presence of a checksum into end-to-end acceptance.

Download the self-contained reproduction package, inspect the nine-row data and 36 recorded reader observations, and follow the reproduction guide. The package retains both captures, the exact runner and regression tests. Repeated runs on one binary establish repeatability, not independent implementation evidence. No benchmark, arbitrary damaged-archive guarantee, authenticity or crash-durability claim is made.

FLAC: a configured check is not an executed comparison

A successful full decode can occur without the requested MD5 comparison. In selected native controls on libFLAC 1.4.3 and 1.5.0, seeking to sample zero disabled comparison although the configuration getter stayed true and all 4096 samples per channel were returned. A fresh enabled read rejected the wrong stored sum at finish(); seeking and then resetting restored that rejection. This reproduces the documented API behavior, not a newly discovered codec flaw. [Decoder API] [Version-pinned contract]

Eight selected API observations; identical displayed results on both tested builds. The complete experiment has 84 operations on six synthetic files. Samples means samples per channel; the MD5 column is the setting getter, not proof of an active check.
Fixture and operationSamples returnedMD5 settingError callbacksProcess resultFinish result
Intact; checking enabled4096true0truetrue
Wrong MD5; fresh full read4096true0truefalse
Wrong MD5; default settings4096false0truetrue
Wrong MD5; seek to zero4096true0truetrue
Wrong MD5; seek then reset4096true0truefalse
Unset MD5; checking requested4096true0truetrue
Damaged frame; default settings3840false3truetrue
Damaged frame; read suffix2048true0truetrue

The C observer records errors and permits continued processing. The damaged-frame/default row reached end-of-stream with three error callbacks and only 3840 of 4096 samples, despite both true results. The suffix row covers only samples 2048 onward. Neither establishes full-file acceptance. The normal flac CLI rejected this damaged file on both builds; the table must not be read as evidence of silent CLI acceptance.

Missing reference and mismatched reference are also different. For the unset-MD5 fixture, flac -t -s returned zero with a warning; flac -t -s -w returned one. Warning escalation rejects this tested missing-reference case, not every preservation failure. [CLI policy]

Sample equality is narrower than preservation of meaning. Valid encodings of the same sample bytes at 48 and 96 kHz had equal sample MD5 values but different declared durations. Changing the channel-mask comment from front to back speakers left every audio-frame byte unchanged and passed strict CLI testing. These are same-input digest examples, not MD5 collisions or playback measurements. The rate variant was consistently re-encoded, not patched into incompatible frame headers. [RFC 9639, sections 8.2 and 8.6.2]

For a library-based full pass, enable checking before initialization, require a nonzero stored reference, track callback errors and intended coverage, avoid seeking during validation, and inspect the finish result. The getter alone cannot certify execution. When reusing a decoder for another file, re-enable the setting before each initialization: finish() restores the defaults, whereas reset() restores checking from the current configured value. [Decoder lifecycle] For exact-file preservation, retain a previously trusted external file/version manifest; for a migration allowing re-encoding, specify sample sequence, rate, channel meanings, bit depth and required metadata separately.

These are deterministic controls on two versions and one host, not corruption rates, independent peer replication, a hardware experiment or an all-decoder guarantee. Inspect the generated table, claims linked to observations, method and replay guide and complete reproduction package. The original captures and diagnostics are retained without editing. See also the Checksum record and checksum scope and object identity.

CPIO: a checksum error can still return success

The CPIO format named crc stores a 32-bit unsigned byte sum, not a cyclic redundancy check. It covers payload bytes, not the member name and permissions. A permutation preserves the sum; a compensating byte increase and decrease can preserve it too. These are algebraic properties, not estimated corruption probabilities. [CPIO format] [Format manual]

Our eleven synthetic fixtures contain one 23-byte regular file. The unchanged payload's sum is 1573. Two retained captures compare four GNU cpio 2.15 operations with a libarchive 3.7.2 reader loop that reads each returned entry to data EOF and iterates headers until archive EOF, stopping on error. Fresh same-host replays match the retained observations; these are repeats, not independent replication. The original bytes, commands, diagnostics and runtime fingerprints are available below. Archive EOF is a parser event: the pinned reader returns it at TRAILER!!!, so it does not prove that every trailing input byte was examined. [Reader source]

A one-bit payload change made GNU verify-only, stdout and disk extraction report a checksum error while returning exit status 0. Listing printed the name without a checksum diagnostic. The tested libarchive reader returned the changed bytes and reached archive EOF without reporting that mismatch. This is version-specific behavior: GNU's relevant paths call error(0, ...), while the pinned libarchive reader does not implement the comparison. [GNU source] [Options] [Reader source]

Designed controls, GNU cpio 2.15 and libarchive 3.7.2. GNU verify uses --only-verify-crc; its exit status and diagnostic are separate columns. Recovery requires the expected single file, name, permission bits and exact bytes, plus successful GNU disk extraction without diagnostics. The libarchive column reports archive EOF, not input exhaustion.
FixtureSum comparisonGNU verify exitGNU diagnosticlibarchive reaches EOFRecovery contract
crc: unchangedmatch0NoYesPass
newc: unchangedabsent0NoYesPass
One payload bit changedmismatch0YesYesReject
Two bytes swappedmatch0NoYesReject
Balanced byte changesmatch0NoYesReject
Filename changedmatch0NoYesReject
Permissions changedmatch0NoYesReject
Stored sum changedmismatch0YesYesReject
Changed data, new summatch0NoYesReject
newc: payload bit changedabsent0NoYesReject
Payload truncatedincomplete2YesNoReject

The permutation and balanced-change rows alter bytes without changing the stored sum. Resealing is different: it replaces the sum after altering data. Name and permission changes leave the payload hash intact because those fields are outside the sum. The truncated-payload control makes GNU return 2 and libarchive fail a data read; the probe can observe failures.

Recovery implication: checking only exit status accepts the measured GNU mismatch. Checking diagnostics still misses equal-sum changes and uncovered metadata. Compare against an independently trusted expectation of contents, inventory and required metadata, in isolated staging before accepting output. A hash calculated only after receipt cannot establish the intended original.

Output is not acceptance: the measured GNU stdout and disk-extraction modes expose the altered payload despite the checksum diagnostic. Do not send unchecked stdout directly to an irreversible downstream operation. Stage the output, finish the checks, then release it. This is an engineering consequence of the recorded output, not a crash-durability protocol.

BagIt distinguishes inventory completeness from checksum validity, without promising protection against replacement of both data and manifests. Its payload manifest records paths and content digests; those fields alone do not verify POSIX permissions. Required filesystem metadata must be recorded and checked separately, whether carried in additional bag metadata or another recovery manifest. [BagIt, sections 2.1.3, 3 and 5.4]

This is not a kernel boot or secure-boot experiment. Linux v6.8's regular-file unpacking path does compare the sum; a userspace reader result cannot be transferred to that path. Inputs here are uncompressed, with no hostile paths, links, ACLs or xattrs. No field failure rate, durability guarantee or hardened-extractor claim is made. [Kernel source]

Inspect the eleven-row data, full native observations and source fingerprints; download the self-contained reproduction package or follow its guide. Related definitions: checksum and archive member.

A decoder window limit is not an output budget

A valid, highly compressed stream can still overwhelm its destination. The Zstandard window describes decoding history, not the cumulative number of bytes a restore may write. A decompression bomb exploits resource amplification; malformed input is not required. [RFC 8878] [CWE-409]

We separately encoded a 2 MiB string of repeated ASCII A bytes with window settings of 1 KiB and 2 MiB. Both frames include content checksums and deliberately omit the optional content-size field. The small-window frame produced 2 MiB under -M1MiB; the large-window frame was refused at that limit and accepted under -M4MiB. Concatenating two small-window frames produced 4 MiB under the same -M1MiB setting.

Four additional fixed cases on Zstandard 1.5.5. MiB = 1,048,576 bytes. The decoder limit is the CLI setting, not measured process memory or an output quota.
Window bytes / frameFramesDecoder limit (bytes)Stored bytesDecoded bytesExit / exact match
102411048576821320971520 / Yes
2097152110485768601 / No
2097152141943048620971520 / Yes
1024210485761642641943040 / Yes

The two large-window rows use identical compressed input. Only the decoder limit changes. The small-window rows demonstrate that even a valid stream with modest history requirements can exceed that setting in total output. These deliberately repetitive inputs are not representative compression ratios, hostile workloads or a measurement of memory consumption. The resource supplement measures CLI window-limit acceptance, not actual peak memory.

The pinned library API documents ZSTD_d_windowLogMax as a streaming-window allocation restriction, not a single-pass decoding limit or a process-wide memory ceiling. ZSTD_getFrameContentSize() describes only the first frame, can return an unknown-size result, and must not be trusted blindly for allocation. Those API facts are documentation findings; this experiment uses the CLI, not a direct library call. [Zstandard API]

Engineering implication: impose separate limits on accepted window size, cumulative decoded bytes and processing time. Count output across all frames before forwarding bytes beyond the allowed budget. A size field can support early rejection, but cannot replace runtime accounting. If a container permits nested archives or many entries, bound those dimensions separately. The harness below is a fixed-input demonstration, not a safe untrusted-archive extraction service.

Python Zstandard: the wrapper changes the acceptance boundary

On the tested python-zstandard builds, an option named max_output_size did not cap every returned payload. A frame declaring 4096 decoded bytes returned all 4096 with the argument set to 64. The same payload encoded without a content-size field raised an error at 64. This is a binding-level observation, distinct from the CLI window-limit experiment above.

We ran 48 call configurations on each of the C-extension and CFFI backends in python-zstandard 0.24.0 and 0.25.0: 192 observations on CPython 3.12.3, Linux x86-64, with libzstd 1.5.7 in both wheels. Twelve deterministic inputs cover known/unknown sizes, appended frames, checksum damage and truncation. Complete frames request a content checksum. The nonempty first payload is 4096 bytes; the second payload B is 14 bytes. These are small correctness controls, not measured memory consumption or archive failure rates.

Both tested versions produced these outcomes. Strict means allow_extra_data=False; argument and buffer sizes are bytes. A successful return is not a whole-object acceptance verdict.
Controlled caseC extensionCFFI
Known size; argument 64; strictReturns 4096 bytesReturns 4096 bytes
Unknown size; argument 64; strictRaises ZstdErrorRaises ZstdError
Known size plus B; default suffix policyReturns 4096 bytesReturns 4096 bytes
Unknown size plus B; buffer 4096; strictRaises ZstdErrorRaises ZstdError
Unknown size plus B; buffer 8192; strictReturns 4096 bytesRaises ZstdError
Empty frame; damaged checksum; strictReturns 0 bytesReturns 0 bytes
Empty frame; header only; strictReturns 0 bytesReturns 0 bytes
Empty frame; damaged checksum; object APIRaises ZstdError; eof=FalseRaises ZstdError; eof=False
Empty frame; header only; object APIReturns 0 bytes; eof=FalseReturns 0 bytes; eof=False

A larger buffer changed strict suffix handling

For an unknown-size first frame followed by B, both backends rejected the extra frame with an exact 4096-byte buffer and strict suffix handling. Increasing the buffer to 8192 made the C extension return only the first payload, while CFFI still rejected the suffix. The input did not change. The pinned C source places the extra-input check in an else if after the output-resize branch; CFFI has no corresponding resize alternative. Known frame size selects allocation directly in both implementations. [C source] [CFFI source]

Empty output did not prove that an empty frame was checked

Both one-shot backends returned empty bytes for a checksum-damaged empty frame and for its six-byte header alone, even with strict suffix handling. Their declared-zero-size path returns before streaming decode. Incremental object controls rejected the bad checksum and reported eof=False for the header-only input. Payload equality alone would accept both empty results. This is not evidence that the format checksum failed to detect damage; those one-shot paths did not establish full-frame validation. [C source] [CFFI source]

For recovery, record the package version, backend and API as well as the codec. Keep resource admission, terminal completion, input coverage and expected object identity separate. Incremental eof and unused_data help distinguish these obligations, but an incremental call may allocate output before a caller checks its size: substituting decompressobj() is not a production memory limit. Valid concatenated frames are permitted by the format; rejecting B is the chosen one-frame policy, not a finding that B is invalid. [API documentation] [RFC 8878, section 3.1]

A separate-session replay passed all 13 regression tests in normal and optimized Python modes on both pinned versions. This is same-host repeatability, not external peer replication. No result here certifies other wrappers, architectures or releases. As with the VXA lesson below, test the recovery path that will actually run, including its acceptance checks; we did not run VXA.

Table and source hashes / 0.24.0 observations / 0.25.0 observations / Runnable evidence package / Review and reproduction notes.

An overlooked FAST lesson: preserve the decoding path

Bryan Ford's FAST 2005 VXA paper packaged decoders with compressed content and ran them in a restricted x86-32 environment. Its six-codec evaluation used kernel sources and media files on an Athlon 64 system. Figure 7 measured user-mode CPU time, not end-to-end restore time. The reported slowdown reached 11% relative to native x86-32 after a Vorbis adjustment; it is not a modern hardware estimate. [VXA paper]

Section 2.3 makes a practical distinction: testing a native decoder does not test an archived fallback decoder. Section 2.5 limits the proposal to decoding compressed streams, not preserving every document's semantics. We reviewed the paper, but did not run VXA or audit its historical sandbox. The lesson here is to test the actual future recovery path, not to execute old embedded code without isolation. [VXA paper]

A runnable decoder still needs an acceptance check

Isolation and correct output are separate properties. VXA section 2.4 explicitly allows a buggy isolated decoder to produce garbled output even when the virtual machine protects the host. Applied to our CPIO results, retaining a runnable reader also retains its verification policy; reproducible execution alone does not establish the intended recovered content. Preserve an independently trusted acceptance check alongside the decoding path. This is our engineering synthesis of VXA and the end-to-end argument, not a VXA experiment or a proof that an old sandbox remains secure. [VXA, section 2.4] [End-to-end paper]

Compressed indexes also need decoding metadata

Elias-Fano stores ordered integers in low-bit and unary high-bit streams. Auxiliary indexes enable efficient access; payload bits alone are not a complete searchable structure. [Vigna, sections 4-7]

Partitioning can exploit local clusters, but chunk boundaries and locations cost space too. The published design optimizes a cost that includes metadata. [Ottaviano and Venturini, section 4]

Two synthetic 32-value inputs, both spanning 0 through 1039. Sizes in bits: Plain and Split are payloads; Meta is toy headers; Total is Split + Meta. Not a native codec measurement.
InputPlainSplitMetaTotal
Two clusters2246262124
Spread22422262284

The clustered input is 0-15 followed by 1024-1039. The spread input uses floor(i * 1039 / 31) for i=0 through 31. With U=1040 and n=32, one stream uses five low bits per value: 160 low bits plus 64 high-stream bits. Changing the internal gaps does not change that total.

Our two 16-value chunks each subtract their first value. The toy header stores a six-bit partition count, then an eleven-bit base, six-bit value count and eleven-bit local universe per chunk: 6 + 2 * (11 + 6 + 11) = 62 bits. Clustering saves space here; splitting the spread input costs more.

Both layouts receive global n and U externally. The high stream ends at its final one; no trailing empty buckets are stored. Alignment, select indexes and checksums are excluded. This sequential recipe is not the SIGIR implementation. Preserve the encoding parameters and boundaries alongside an index; compact payload is not a recovery plan. The calculation and tests expose every counted field.

RubikFS: the layout is part of the decoding path

RubikFS is a FAST 2026 research extension of EROFS, not a new compression codec or an established upstream feature. Its builder groups similar chunks before compression and can separate hot data. Reordered chunks need mappings back to their logical file positions; a retained compressed block is not, by itself, a complete file-recovery recipe. [Huang et al., sections 4-5]

The existing read-only image comparison explains why equal block-size labels do not imply equal decoded spans. Here, the additional recovery question is whether the retained metadata and reader can reconstruct the original file coordinates, not just decompress a block. [Sections 4.6 and 6.1]

Keep the denominator when reading a headline result

The authors report up to 42.60% higher compression ratio than the compared read-only file-system configurations. The ratio is original bytes divided by compressed bytes. For a fixed original size and the same accounting boundary, multiplying that ratio by 1.426 leaves 1 / 1.426 of the former compressed size: approximately 29.87% fewer compressed bytes, not 42.60%. This is an algebraic interpretation of the reported percentage, not a remeasurement, an average saving or a prediction for another image. [Abstract and footnote 2]

The compression study covers six images and three codecs. The read-amplification experiment instead uses generated openEuler hot-file/page traces in FEMU/QEMU, not startup measurements on six physical devices. Sorting adds work, but total build time can decrease when compression becomes faster (Table 3). Hesela has not reproduced these measurements; the paper's results should remain attached to their images, codec settings and access patterns. [Sections 6.1-6.5]

Fewer bytes can still take longer

Reported RubikFS results with hotness grouping: openEuler, generated 12% hot-data trace (18.07 MB), 1 MB blocks, FEMU/QEMU. Units follow Table 2.
CodecRead size (MB)Time (s)
LZ416.411.21
ZSTD13.371.63
LZMA10.133.72

LZMA reads less than LZ4 here, yet takes longer. Read volume and decompression cost must be considered together. These are the authors' point results, not confidence intervals or a hardware benchmark reproduced by Hesela. [Table 2 and section 6.4]

For an image-preservation plan, keep the matching reader and the metadata needed to recover file coordinates, then verify recovered files against an independently trusted manifest. That is our engineering synthesis, not a tested RubikFS corruption-recovery result. The seek-table experiment below demonstrates the separate coordinate problem in Zstandard; it is not evidence of a RubikFS defect.

Random access is another contract

For compressed offset and identifier lists, see the separate payload and metadata calculation.

The Zstandard seekable extension splits content into independently compressed frames and appends a seek table in a skippable frame. Entries give compressed and decompressed sizes, with optional checksums. This supports locating a range without decoding everything before it; it is additional structure, not a property guaranteed by any file ending in .zst. [Seekable format]

A successful range read is not a completed integrity check. In a separate Hesela experiment, the v1.5.7 reference seekable decoder returned all 192 expected bytes despite a deliberately wrong final-frame checksum. A whole-input decoder rejected that same physical-checksum fixture. With a wrong seek-table checksum instead, whole-input decoding also succeeded: ordinary decoding skips the index metadata. [Retained native evidence]

The study uses 30 bounded synthetic inputs: three 64-byte data frames, index mutations, empty/skippable controls and two final-checksum mutations. Each capture records 480 isolated actions, including initialization failures and caller exclusions, not independent successful trials. Two retained 1.5.7 captures agree; outcomes also agree when the same reference decoder is linked to libzstd 1.5.5. A separate C caller supplies 119 controls per configuration. Both configurations ran on one host and use one decoder implementation.

Six selected retained controls. Offsets are zero-based decoded-byte coordinates. Expected content is bytes 0 through 191. API success and matching requested output do not establish index consistency.
Controlled changeOffset / requested bytesAPI result / returned bytesMatches expected rangeWhole-input decoder
Index sizes redistributed64 / 1Success / 1NoSuccess
Middle physical checksum changed64 / 64Success / 64YesError
Last physical checksum changed0 / 192Success / 192YesError
Last index checksum changed0 / 192Success / 192YesSuccess
Zero-output entry checksum changed0 / 192Success / 192YesSuccess
Last index entry omitted0 / 192Success / 128NoSuccess

Correct total size can hide incorrect coordinates

Changing two index lengths from 64/64 to 63/65 preserves their sum. Nevertheless, offset 64 with length 1 returned 0x41 (byte 65), not the required 0x40. This is now an actual reference-API observation, supplementing the earlier coordinate model. An independent physical-frame inventory detects the length disagreement. Matching aggregate length and payload checksums cannot replace the per-frame coordinate comparison.

The call boundary changes which checks finish

For the damaged middle physical or table checksum, a fresh 64-byte request returned the complete frame; ZSTD_seekable_decompressFrame also succeeded. A 65-byte request crossed the boundary and failed. Three consecutive requests of 1, 62 and 1 bytes failed on the last call. The pinned source ends the loop at the requested output position; index-checksum comparison is reached when the streaming decoder reports frame completion. These conditions need not coincide. [v1.5.7 implementation]

Requesting one extra byte is not a general remedy: a 193-byte request at offset zero was clamped to 192 and still did not expose the damaged last checksum. Empty or skippable indexed entries create another gap: zero output does not prove that their entry checksums were checked. Omitting the last entry instead yielded a successful short result of 128 bytes. Check the returned length against an independent expectation.

Validate the inventory, then the intended generation

Engineering inference: fully decode the physical compressed extents with checksum verification, compare every physical frame with its index entry (sizes, offsets, count and optional checksums, including zero-output entries), and separately compare with a trusted manifest for the intended generation. Our physical/index inspector rejects the selected inconsistencies. Even a consistent rebuilt archive can be the wrong generation; this extends the earlier dictionary, gzip and archive-member acceptance distinctions.

Why identity needs context outside the decoded bytes

In An Analysis of Data Corruption in the Storage Stack (FAST 2008), Bairavasundaram and colleagues distinguish checksum mismatches from filesystem block-identity discrepancies. Their system checks whether a block belongs to the file and offset being read; its RAID-level scrub cannot perform that contextual check. This is evidence from a particular storage architecture, not a study of compressed archives. [FAST 2008, sections 2.2-2.3]

Application to archive recovery: a decoded frame can be internally consistent yet occupy the wrong output coordinate or belong to the wrong generation. The archive's own index is not an independent expectation when that index may be damaged. Retain the expected object identity outside the archive, bind it to the intended restore, and compare per-frame geometry as well as bytes. This is an engineering analogy, not an estimate of Zstandard failure frequency.

Keep the source buffer or file alive and unmodified for the seekable reader's lifetime, as its API requires. This experiment uses in-memory initialization, not file/custom-I/O paths, large-block workloads or external dictionaries. Deliberately malformed controls establish scoped counterexamples, not field rates, a benchmark, exploitability or an all-version library claim. [API contract]

Inspect the generated six-row summary, complete native capture and reproduction guide, or download the self-contained evidence package. Source fingerprints, build receipts, repeat captures, C controls and scripts are included. This publication integration checks retained evidence; it is not a fresh native run. Definitions: Zstandard and skippable frame.

BGZF and tabix: preserve the coordinate map

Source review: a compressed file and its lookup index have separate jobs. BGZF supplies independently decompressible gzip blocks; a tabix index selects records by genomic interval. Preserving readable blocks is only part of preserving a usable indexed archive.

Heng Li's 2011 Tabix paper combines hierarchical binning with a linear index to avoid unnecessary seeks. Its evaluation used two biological alignment collections, measuring query time, bytes read and seeks. Those results concern retrieval efficiency, not validation of an index paired with a different data generation. [Tabix paper, sections 2-3]

Three distinct coordinate maps. This is a format comparison, not a benchmark.
MapMeaningWhat it does not establish
BGZF virtual offsetCompressed block position plus byte position within its decoded contentA cumulative decoded length obtained by subtracting two offsets
GZI sidecarPairs of compressed block starts and cumulative decoded-byte positionsWhich records overlap a genomic interval
Tabix TBI or CSISequence and interval lookup into a sorted BGZF data fileThat an independently supplied data file is the intended generation

The virtual offset packs a block position into 48 bits and a position within the decoded block into 16 bits. Comparing such offsets is permitted; treating their difference as a decoded-byte count is not. Changing compression or block boundaries may invalidate stored locations without changing decoded content. The bgzip recompression option explicitly depends on matching compression conditions. [BGZF specification] [bgzip manual]

Coordinates are part of the contract. The command-line query chr1:101-110 is 1-based inclusive; the BED interval chr1 100 110 is 0-based half-open and describes the same ten positions. TBI has a 2^29-base coordinate limit. CSI permits different binning geometry; choosing it does not by itself validate index-to-data identity. [tabix manual] [CSI format]

The TBI field layout contains no mandatory data-file digest. Engineering inference: build the index from the final data, compare representative narrow queries with an independently interpreted sequential reference, then preserve both files and their coordinate conventions as one immutable generation. Record both digests in a trusted manifest. Hashing an already mismatched pair merely preserves the mismatch; sampled queries are checks, not a proof of every possible query. [TBI format]

When a valid index returns no matching rows

Measured counterexample: in our three-record synthetic BED fixture, HTSlib 1.22.1 and 1.24 returned zero rows instead of two with exit status zero when generation B was paired with generation A's valid TBI or CSI index. Both files passed their individual BGZF integrity tests. A successful decoder and a successful query did not establish a correct pair.

Only two chr1 coordinate pairs changed, from around 100000 to around 900000; the chr2 record stayed fixed. Native bgzip and tabix produced both generations. The query chr1:900001-900030 and BED target chr1 900000 900030 cover the same positions using their respective coordinate conventions. No index bytes were patched to create the mismatch.

Native observations. Each row has the same displayed outcome for TBI and CSI in both tested releases; these are designed controls, not failure frequencies.
Pair stateData integrityExpected rowsIndexed rowsSequential target rows
Matched generation Apasses000
Matched generation Bpasses222
B + A index; equal mtimepasses202
B + A index; newer indexpasses202
B + A index; older indexpasses202
B + rebuilt indexpasses222
B with damaged CRCrejected2errorerror

Several plausible checks passed on the wrong pair. Full decompression returned all three correct records, name listing returned both expected sequences, and a broad chr1 query and unchanged chr2 query returned their expected rows. Both the narrow command-line query and indexed -R query omitted the two moved records. Rebuilding the index from unchanged B data restored both narrow answers.

An older index timestamp produced a warning but did not change the successful exit status. Equal or newer stale timestamps produced no diagnostic. The inspected HTSlib implementation warns on an older local index and can finish an iterator when no indexed bins overlap. This source explanation is not a physical I/O trace. A deliberately damaged data-block CRC was rejected by the payload-reading controls, distinguishing a mismatched index from a missing CRC check.

The sequential control has a boundary too. -T found the two records here, but the inspected text-query path still loads index metadata. Our fixture preserves sequence names and parsing conventions; this is not a general index-free recovery method. Other mismatches may produce errors rather than silent omission. [Text-query source]

Method and limits: fourteen configurations, nine operations each, repeated twice per release produced 504 retained observations. A fresh replay of both native builds added 252 operations with matching outcomes. All used one host and tiny invented inputs. This is neither real genomic evidence, an incidence estimate, a performance benchmark, a new vulnerability nor independent peer review. The original paper's retrieval benchmarks do not establish this fault result.

Engineering implication: validate data/index agreement before binding both digests and coordinate conventions in a retained generation. Broad queries can miss this problem; use changed-region controls and a separately interpreted sequential reference. Neither a matching pair of checksums nor a manifest created from the wrong pair establishes the intended relationship.

Inspect the generated table and capture hashes, method, limits and reproduction guide, or complete code and evidence package. The package retains the original four captures, two fresh replays, complete command output, fixture bytes, source/build provenance and regression tests. Reproduction checks include executable hashes, not just reported version strings.

Pipefail reports failure; it does not roll back output

Streaming decompression can deliver output before the frame has finished. The Zstandard streaming API distinguishes produced bytes from a completed frame; Bash separately defines how pipeline commands contribute to the final exit status. Neither contract makes a downstream write transactional. [Streaming API] [Bash pipeline status]

We tested four synthetic inputs through three paths: zstd -d -c --check | tee destination, the same pipeline with pipefail, and decoding into a private staging file. Each destination initially held a known previous generation. The staging path replaced it only after decoder success and agreement with the original full payload's length and SHA-256.

Twelve runs, grouped by input. Each mode received identical compressed bytes. Expected decoded size: 1,048,599 bytes. Both direct pipelines overwrote the previous destination bytes in every case.
InputEmitted bytesDecoder exitDefault / pipefail exitStaging decision
Both frames complete1,048,59900 / 0Accept; replace previous
First checksum damaged1,048,57010 / 1Reject; preserve previous
Final byte removed1,048,59910 / 1Reject; preserve previous
Last frame removed1,048,57600 / 0Reject; preserve previous

The checksum-only mutation still wrote 1,048,570 bytes. The decoder exited 1, while tee exited 0. Default Bash therefore reported pipeline success. Enabling pipefail changed the pipeline status to 1, but the destination still contained those emitted bytes. The mutation changed a checksum, not the data blocks; this count is a build-specific observation, not a promised buffering threshold.

Two different gates catch two different failures. Removing the final byte produced all 1,048,599 expected bytes, yet the decoder failed: a hash alone was insufficient. Removing the complete last frame made both pipelines exit zero, but left out 23 bytes: status alone was insufficient. Staging preserved the previous destination for both cases and the damaged checksum, while the complete control was accepted.

Application inference: defer visible publication until the producer status and independently retained expectations both pass. A database import may need a transaction or an equivalent staging-and-commit mechanism; this file experiment does not test a database. A prior test followed by rereading a mutable input also needs an identity guarantee between those reads.

Our staging example uses a private same-directory file and os.replace. Successful replacement provides atomic name replacement on POSIX, not proof of persistence after power loss. We did not call fsync, inject crashes, test concurrent writers or accept untrusted archives. Production recovery also needs resource limits, metadata handling and a durability protocol appropriate to its filesystem. See the separate publication and rename analysis. [Atomic replacement]

Research context: Pillai and colleagues separate atomicity, ordering and durability in their OSDI 2014 study. Their ALICE framework explores crash states from application traces; its findings depend on the modeled persistence properties and tested workloads. In particular, persisting file contents does not by itself persist the directory operation that publishes their name. This is historical crash-consistency evidence, not a Zstandard test or a guarantee about current filesystems. Our staging experiment establishes acceptance before replacement during normal execution, not durable recovery after a crash. [OSDI 2014, sections 2.2, 3.2-3.6 and 4.4]

Reproduce with the output-publication harness and compare the 12 raw observations:

python3 zstd-output-publication.py --output publication.json

Measured: *** Zstandard CLI (64-bit) v1.5.5, by Yann Collet ***; GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu); tee (GNU coreutils) 9.4; Python 3.12.3. Only synthetic files in a temporary directory are modified. These are deterministic contract demonstrations, not failure frequencies or a new codec vulnerability.

A stronger restore acceptance rule

Saltzer, Reed and Clark's 1984 paper End-to-End Arguments in System Design explains why reliable intermediate steps cannot replace the application's final check. Its file-transfer example reads back the destination and compares it with an expectation retained at the source; lower-level checks still help avoid expensive retries. This is a design argument, not an archive benchmark. Our application to these controls is narrower: a restore gate must establish the intended content, coverage and error propagation together. We have not reproduced the paper's network example or tested crash durability. [End-to-end paper]

The following checklist is Hesela's engineering inference from the experiment, not a universal archival standard. A trusted manifest should describe the intended object generation and complete content, not be reconstructed from the damaged input during the restore.

  1. Retain the exact dictionary bytes and bind them to the archive by a cryptographic digest, alongside decoder version, options and required runtime. A short dictionary ID is a lookup hint, not a replacement for that evidence.
  2. Verify expected compressed-object identity before decoding, then verify the full decoded length and digest against independently retained expectations. Protect the manifest itself if malicious replacement is in scope.
  3. Record and test the decoder checksum policy, including a known-bad-checksum control. Require successful validation through the decoder's terminal state as well as matching output; test that failures reach the calling automation, not just its log. Do not publish partial output from a failed restore as a valid recovered object.
  4. Specify which archive member is intended, including duplicate-name policy or an explicit occurrence. Test the same output mode used in recovery; disk and stdout extraction can select different bytes. Verify the intended coverage too: selecting one member or listing names does not check every payload.
  5. Set decoder-window, cumulative-output and time budgets independently. Keep recovered output provisional until all validation succeeds; do not infer an output quota from the decoder memory option.
  6. Test in an isolated environment without relying on a production dictionary cache. Check application-level usability after decoding; matching bytes alone does not prove the recovered system works.

This extends the distinction in backup verification versus restore testing and the identity limits of checksums.

Reproduce without touching stored data

Download the Python harness and inspect the raw JSON observations. Python's standard library and an installed zstd CLI are sufficient:

python3 zstd-archive-contract.py --output observations.json

For the eight formatted-dictionary cases, use the separate identity harness and identity observations:

python3 zstd-dictionary-identity.py --output identity.json

That runner records training parameters, the length-delimited training-corpus hash, all dictionary variants, payload hashes and frame IDs. It uses one training thread and a 30-second limit per subprocess. Its measured environment is *** Zstandard CLI (64-bit) v1.5.5, by Yann Collet ***, Python 3.12.3, Linux x86_64. Repeated observations matched on this build; identical trained bytes across different versions are not promised.

The original runner creates private temporary dictionaries, sends bounded synthetic inputs through pipes and limits each subprocess to 15 seconds. It compares complete output bytes directly; published hashes make those comparisons independently inspectable. Runtime checks remain active under Python optimization. No existing data files are used as test inputs.

The resource-limit supplement has a separate four-case Python harness and JSON result. It generates at most 4 MiB of expected output per decode, uses a 15-second subprocess timeout, and records commands, hashes and frame settings. Its in-memory output capture is not a security limit: the script accepts no external archive input and must not be repurposed for untrusted inputs without an enforced output budget.

python3 zstd-resource-budgets.py --output resource-observations.json

Supplement environment: *** Zstandard CLI (64-bit) v1.5.5, by Yann Collet ***, Python 3.12.3, Linux x86_64. No peak RSS, CPU cost, throughput or HTTP content-coding behavior was measured.

Measured environment: *** Zstandard CLI (64-bit) v1.5.5, by Yann Collet ***, Python 3.12.3, Linux x86_64. Documentation is pinned separately to Zstandard 1.5.7. The fourteen cases are deterministic demonstrations on one build, not fourteen independent reliability trials. They do not establish corruption frequencies, performance, power-loss behavior or general guarantees for other libraries.

Primary sources

  1. python-zstandard 0.25.0: one-shot and incremental decompression APIs
  2. python-zstandard 0.25.0 pinned C extension: Decompressor_decompress allocation, resize and empty-frame branches
  3. python-zstandard 0.25.0 pinned CFFI backend: ZstdDecompressor.decompress
  4. Janos Falucskai: On equivalence of two tests for codes, 2008, section 1, pp. 249-250
  5. Janos Falucskai: A novel test for unique decipherability of codes, 2011, pp. 535-537
  6. Cassaigne and Nicolas: On the decidability of semigroup freeness, arXiv:0808.3112v4, definitions and examples in section 1.1
  7. Brockway McMillan (1956): Two Inequalities Implied by Unique Decipherability, IRE Transactions on Information Theory 2(4), 115-116
  8. Bryan Ford: VXA: A Virtual Architecture for Durable Compressed Archives, FAST 2005, sections 2 and 5
  9. RFC 8878: Zstandard Compression, sections 2, 3, 3.1.1, 3.1.2 and 5
  10. Zstandard v1.5.7 CLI manual: dictionaries, checksums and dictionary-ID omission
  11. Zstandard v1.5.7 API manual: dictionary identification and decompression
  12. Zstandard seekable format 0.1.0, pinned to v1.5.7
  13. GNU tar 1.35: appending files and repeated member names
  14. GNU tar 1.35: Writing to Standard Output
  15. GNU tar 1.35: --occurrence and early completion
  16. Python 3.12 tarfile: getmember, getmembers and extractfile
  17. GNU tar 1.35: Basic Tar Format, header checksum coverage
  18. RFC 1952: GZIP file format specification 4.3, sections 2.2, 2.3.1 and 2.3.1.2
  19. Python 3.12 gzip documentation: multi-member decompression and errors
  20. Python 3.12 zlib documentation: eof, unused_data and unconsumed_tail
  21. CPython v3.12.3 gzip.py: GzipFile.close and _GzipReader._read_eof
  22. zlib v1.3 public interface: inflate stops at a gzip member boundary
  23. Python 3.12 zipfile: ZipInfo selection, testzip and command-line testing
  24. CPython v3.12.3 zipfile implementation: testzip, NameToInfo and CLI main
  25. CPython issue 156539: testzip skips earlier duplicate members (reported August 2026)
  26. PKWARE ZIP APPNOTE: local headers, central directory and CRC fields, sections 4.3.7 and 4.3.12
  27. Saltzer, Reed and Clark: End-to-End Arguments in System Design, ACM TOCS 2(4), 1984
  28. GNU tar 1.35: Ignoring Blocks of Zeros
  29. GNU tar 1.35: Combining Archives with --concatenate
  30. GNU gzip: Advanced usage, concatenated members
  31. Python 3.12 TarFile: ignore_zeros and salvage behavior
  32. CPython v3.12.3: TarFile.next header handling
  33. RFC 8493: BagIt 1.0, complete and valid bags (section 3), security (5.4)
  34. Elizabeth D. Zwicky: Further Torture: More Testing of Backup and Archive Programs, LISA 2003
  35. GNU tar 1.35: Keep Old Files
  36. Zstandard v1.5.7 reference seekable decoder: range completion and checksum checks
  37. Zstandard v1.5.7 seekable API: read semantics and source lifetime
  38. Hesela: native seekable-decoder observations, source fingerprints and reproduction
  39. Bairavasundaram et al.: An Analysis of Data Corruption in the Storage Stack, FAST 2008, sections 2.2-2.3
  40. XZ v5.4.5 list.c: parse_check_value and parse_details
  41. XZ v5.4.5 manual: test/list modes, data-check policy and --ignore-check
  42. XZ format 1.1.0: stream structure, Block Check and Index
  43. XZ v5.4.5 liblzma container API: absent/unsupported check notifications
  44. Zhang et al.: End-to-end Data Integrity for File Systems: A ZFS Case Study, FAST 2010
  45. XZ for Java 1.10: SingleXZInputStream completion and pending-exception contract
  46. XZ for Java 1.10: XZInputStream concatenation and input-end handling
  47. GNU tar 1.35: Using tar to Perform Incremental Dumps, section 5.2
  48. GNU tar 1.35: Dumpdir control codes and omitted payloads
  49. Maheshwari, Vingralek and Shapiro: How to Build a Trusted Database System on Untrusted Storage, OSDI 2000, sections 6.2-6.3
  50. Linux v6.8 initramfs format: c_magic and c_chksum
  51. libarchive v3.7.2 cpio(5): New CRC Format and Bugs
  52. GNU cpio 2.15 source: copyin.c lines 523-545 and 1561-1568; paxexit*.c
  53. GNU cpio manual: --only-verify-crc
  54. libarchive v3.7.2 CPIO reader: format detection, header_newc and read_data
  55. Linux v6.8 initramfs.c: do_header, xwrite and do_copy
  56. SAM/BAM specification: BGZF framing and virtual offsets, section 4.1
  57. HTSlib 1.24 bgzip manual: GZI offset pairs, integrity testing and recompression
  58. Heng Li. Tabix: fast retrieval of sequence features from generic TAB-delimited files. Bioinformatics 27(5), 718-719 (2011).
  59. HTSlib 1.24 tabix manual: coordinate conventions, TBI limit and CSI selection
  60. The Tabix index file format: fields, coordinate flag and chunk offsets
  61. CSI version 1: configurable binning geometry and auxiliary metadata
  62. HTSlib 1.24 hts.c: index timestamps and interval iterators
  63. HTSlib 1.24 tabix.c: text queries still load index metadata
  64. MITRE CWE-409: Improper Handling of Highly Compressed Data (Data Amplification)
  65. GNU Bash reference manual: Pipelines (also checked against the installed Bash 5.2 manual)
  66. Zstandard v1.5.5 public API: streaming decompression, output positions and completion
  67. Python 3.12 os.replace: same-filesystem atomic replacement semantics
  68. Pillai et al.: All File Systems Are Not Created Equal, OSDI 2014, sections 2.2, 3.2-3.6 and 4.4
  69. Xiph libFLAC decoder API: configured MD5 flag, seek/reset and finish
  70. libFLAC 1.4.3 pinned decoder contract: setting getter versus active checking
  71. RFC 9639: FLAC sample MD5 and channel-mask interpretation, sections 8.2 and 8.6.2
  72. Xiph FLAC CLI manual: test mode and warnings-as-errors
  73. Maxino and Koopman (2009): The Effectiveness of Checksums for Embedded Control Networks, sections 3 and 3.5; DOI 10.1109/TDSC.2007.70216
  74. RFC 1950: zlib DICTID, decoded Adler-32 and checksum recurrence, sections 2.2 and 9
  75. RFC 1951: DEFLATE reversibility, blocks and encoding choices, sections 1.1, 2, 3.2-3.3 and 4
  76. zlib 1.3.1 manual: deflateSetDictionary and inflateSetDictionary
  77. zlib v1.3 inflate.c: FLAGS and HCRC checks
  78. zlib v1.3 gzread.c: transparent input and gzip member transitions
  79. Ziv and Lempel (1977): A Universal Algorithm for Sequential Data Compression, introduction
  80. Claude E. Shannon, A Mathematical Theory of Communication (1948), sections 9-10; corrected reprint
  81. Jarek Duda: Asymmetric numeral systems, arXiv:1311.2540v2 (2014), sections 2.3, 3.7 and 4
  82. Zstandard v1.5.7 format: entropy coding and sequence compression modes
  83. Sebastiano Vigna, Quasi-Succinct Indices, WSDM 2013, sections 4-7; DOI 10.1145/2433396.2433409
  84. Giuseppe Ottaviano and Rossano Venturini, Partitioned Elias-Fano Indexes, SIGIR 2014, sections 4-5; DOI 10.1145/2600428.2609615
  85. Apache Parquet: hybrid RLE/bit-packing encodings
  86. Apache Arrow: columnar Boolean buffers and alignment
  87. Melnik et al., Dremel: Interactive Analysis of Web-Scale Datasets, PVLDB 3(1), 2010, sections 4.1-4.3
  88. RFC 9639: FLAC residual coding, sections 4.4 and 9.2.7
  89. David A. Huffman (1952), A Method for the Construction of Minimum-Redundancy Codes, Proceedings of the IRE 40(9), 1098-1101; DOI 10.1109/JRPROC.1952.273898
  90. Lemire and Boytsov: Decoding billions of integers per second through vectorization, sections 2.6-2.8 and 5
  91. Apache Parquet: DELTA_BINARY_PACKED encoding and reconstruction context
  92. Zukowski, Heman, Nes and Boncz: Super-Scalar RAM-CPU Cache Compression, ICDE 2006, sections 2.1 and 3.1
  93. Claude E. Shannon: A Mathematical Theory of Communication (1948), sections 6 and 9, Theorem 9
  94. Ian H. Witten, Radford M. Neal and John G. Cleary: Arithmetic Coding for Data Compression, CACM 30(6), 520-540 (1987), DOI 10.1145/214762.214771
  95. RFC 6716: Definition of the Opus Audio Codec, sections 4.1 and 5.1.5, range coding and finalization
  96. Drmota, Reznik, Savari and Szpankowski: Precise Asymptotic Analysis of the Tunstall Code, ISIT 2006, sections I-II
  97. Ziv and Lempel (1978): Compression of Individual Sequences via Variable-Rate Coding, pp. 530-536
  98. Welch (1984): A Technique for High-Performance Data Compression, pp. 8-19
  99. CompuServe GIF89a: Appendix F and deferred-clear clarification
  100. Aldus TIFF Revision 6.0 (1992): sections 13-14, LZW compression and differencing predictor
  101. LZ4 v1.10.0: block format, LZ77-type byte-oriented encoding, offset limits and out-of-band metadata.
  102. Huang et al. Towards Condensed and Efficient Read-Only File System via Sort-Enhanced Compression. FAST 2026, pp. 35-51; sections 4-6.
  103. RFC 3309: SCTP Checksum Change, section 1 (September 2002)
  104. Jonathan Stone and Craig Partridge: When The CRC and TCP Checksum Disagree, SIGCOMM 2000, section 6, pp. 317-318
  105. GNU gzip 1.14 release: multi-member listing fix (9 April 2025)
  106. GNU gzip 1.14 release source: gzip.c, unzip.c, NEWS, tests/list and doc/gzip.texi
  107. Hesela: ZIP extraction failure states, retained captures and reproducibility package
  108. CPython v3.12.3 shutil: copyfileobj and COPY_BUFSIZE
  109. Pillai et al., All File Systems Are Not Created Equal (OSDI 2014), sections 3 and 4.4

Codec sources checked 17 October 2026; TAR, gzip, ZIP and Python sources checked 18 October 2026. TAR boundary and continuation sources checked 21 October 2026; hard-link sources reviewed 22 October 2026; seekable-format sources and retained native evidence reviewed 23 October 2026; XZ sources and FAST 2010 lifecycle analysis reviewed 24 October 2026. NPY/NPZ cross-reference checked 24 October 2026. CPIO sources and native replay checked 25 October 2026. BGZF/tabix sources reviewed 25 October 2026. All test data are synthetic; no external dataset is redistributed.

Published by Hesela team · Published · Updated

Report a correction · Editorial standards · Reuse guidance

Change history

: first published.

  1. · Update: Integrated retained native seekable-reader evidence: output coordinates, checksum completion, zero-output entries and index coverage; generated six-control table and reproducible evidence package.

: latest recorded update. A detailed change note is not available for this revision.

New-publication RSS · Correction RSS

Cite this page
Hesela team. Compressed archives: intact bytes can still be unreadable. Hesela. 2026-12-02. https://hesela.com/analyses/compressed-archives-dictionary-dependencies/