Interactive engineering lab

ZIP readers: descriptor size versus central directory size

ZIP readers: descriptor size versus central directory size. Compare three reader decisions for ZIP members whose descriptor and central sizes differ.

By Sandeep Belgavi · Published 2026-11-26

Synthetic fixtures computed locally. No model or production service is contacted.

Experiment workspace

Decision trace

    The question this experiment answers

    When a ZIP member records its compressed size in two places, its data descriptor and the central directory, what do different readers do if the two disagree? The lab models three decisions for each member: a central-directory reader modelled on Python zipfile, a streaming installer modelled on uv before and after 0.13.10, and the agreement check that requires the bytes read, the descriptor size and the central size to be equal. It is a defensive model built from advisory GHSA-vjvj-3m3f-fgmm and uv pull request 23332, not a ZIP parser.

    Change one assumption at a time

    Scenario preset loads a list of members. Each line is a member name, whether it uses a data descriptor (yes or no), the actual compressed size in bytes, the size recorded in the descriptor and the size recorded in the central directory. For a member without a descriptor the descriptor column is ignored. Installer policy chooses uv 0.13.9 and earlier, which checks the descriptor but does not compare the central size, or uv 0.13.10, which rejects members whose sizes disagree. Run experiment after editing to update the result.

    Expected outcomes

    The understated preset with the uv 0.13.9 policy has three members and one disagreement: the central-directory reader reads a 29-byte prefix of pkg/__init__.py, fails the CRC check and rejects it, while the streaming installer extracts the full 86 bytes. Switching to uv 0.13.10 removes the disagreement because both readers now reject the member. The clean preset has no disagreements under either policy. The overstated preset disagrees under 0.13.9 and agrees under 0.13.10. The descriptor preset disagrees under both policies, because the streaming installer rejects a descriptor that does not match the bytes it read while the central reader accepts the member.

    Read the table and the trace

    Each table row is one member with its three sizes, the central-directory reader decision, the streaming installer decision and whether the two reach the same decision. The decision trace starts with the inputs and explains each member in one sentence, then summarises. Start trace, Next step, Show all and the slider reveal a prefix of the same steps without recomputing.

    Reset and export

    Reset inputs restores the first preset and the uv 0.13.9 policy and reruns them. Export JSON downloads the member list, every row, the metrics, the trace, the model version and the limitations. Editing the list disables export until the next run, so a stale result is never exported against new inputs. Nothing is stored or sent.

    Limits

    Only the CRC-mismatch outcome of a short central size is modelled. The advisory also describes a case where a prefix and the full file share a CRC-32 so both installers accept different content; that case is described, not constructed or simulated. Sizes are abstract byte counts and a reader reading past the member data is modelled as a rejection. Upgrade uv to 0.13.10 or later rather than relying on this model. Views are my own and do not represent any employer, past or present.