interplane.Get Omega
Read in your language

omega-zip

omega-zip: ZIP archive reader in seeded Omega (store and deflate, CRC-32, fail-closed refusals)

Brought by drakestapleton

Unfinished: not checked yet

There is no published receipt of a rebuild from its source yet. What a receipt is

Get this repository
Git over HTTPS
git clone --no-checkout https://interplane.io/projects/omega-zip/repo.git omega-zip && git -C omega-zip checkout --detach 68c1a0c7d035e639c34ff181eccf3d58496f3338
Source archive of 68c1a0c7d035e639c34ff181eccf3d58496f3338
Download ZIP · tar.gz

README.md

omega-zip

I wrote omega-zip so that a zip file, a zlib stream or a raw DEFLATE stream can be read by a tool whose every line anyone can inspect. It is written in Omega (seeded Omegese) and built by the pinned seed-born compiler; nothing else runs inside it. It is the first engine of the no-black-box tools (slice S1): Office files (.docx, .xlsx, .pptx, .odt) are zip archives, and most PDF streams are zlib.

One program, ozip:

commandwhat it does
ozip crc32CRC-32 of stdin, 8 lowercase hex digits and a newline
ozip inflateraw DEFLATE (RFC 1951) on stdin to stdout
ozip zliba zlib stream (RFC 1950) on stdin to stdout, Adler-32 checked
ozip l ZIP / ozip v ZIPlist the entries, byte for byte what Info-ZIP UnZip 6.0 prints for unzip -l / unzip -v (name, sizes, method, CRC, date)
ozip t ZIPdecompress every entry and check its CRC-32, no output
ozip p ZIP [NAME]every entry (or the one named, an exact name) to stdout, like unzip -p
ozip x ZIP DIR [NAME]extract into the existing directory DIR

Stored (0) and deflated (8) entries are read; the CRC-32 of every extracted entry is checked.

What the proof proves, and what it does not

The gate below proves that the ozip built from exactly these sources by the pinned compiler gives the oracle's bytes on the corpus, refuses the malformed inputs with the stated codes, kills the stated mutants, and never traps or hangs on 32,960 cut or changed inputs. It does not prove that ozip is correct on every input, that it is fast, or that a file it reads is harmless: it reads what the archive says, within the bounds below.

Build

The compiler is omega-mv's seed-born seed/out/omc at the commit in PIN (sha256 in PIN). With an omega-mv checkout at that commit (sh seed/omega-from-seed.sh rebuilds omc from the seed and must give the same sha256):

OMC=/path/to/omega-mv/seed/out/omc
cat src/head.om vendor/omega-mv/seed/text/text.om src/io.om src/crc32.om src/inflate.om \
    src/zlibd.om src/unzip.om src/main.om | $OMC > ozip && chmod +x ozip

The units must be in that order (src/head.om carries the om2 line). The output is a static Linux AArch64 executable. tests/gate.om builds the same way (its UNITS text) and is the receipt.

Gate

mkdir -p build && $OMC < tests/gate.om > build/gate-bin && chmod +x build/gate-bin && build/gate-bin $OMC

Run from the repository root. The last line on success:

OZIPGATE PASS cases=219 mutants-killed=19/19 robust-runs=32960

It exits 0 on PASS, 1 on any failure, 3 (NOT_RUN) when the compiler's SHA-256 is not the pin. It computes that SHA-256 itself (FIPS 180-4). Then it:

  1. builds build/gate/ozip from the units;
  2. runs the 219 cases of tests/cases.txt: exit status, stdout against the oracle's bytes, and stderr (empty after success; exactly one line ozip: ... after a refusal), plus extraction checks (xcmp, xabsent: the extracted file equals the original; nothing was written outside DIR);
  3. builds each of the 19 mutants of tests/mutants.txt (one source line replaced: a wrong distance base, a wrong length base, a 16 KiB window, no distance-too-far check, no stored length check, a wrong CRC polynomial, no CRC check, no path check, no local header check, no Adler-32 check, no local name, method or flag comparison, no descriptor size comparison, no data-before-directory check, no directory size or end check, no ZIP64 size sentinel, no overlap check) and requires a failing case for each;
  4. robustness: every raw, zlib and zip corpus file (103 files) cut at 64 points and changed at 256 single bytes; every run must end with 0 or a documented code, never a trap (exit 101..114), a signal or the 10 s limit, and an exit 0 of zlib or p must give the oracle's bytes. Raw DEFLATE has no checksum, so a changed byte may decode to other bytes; those runs are counted, not failed.

The oracles are test tools only, never part of omega-zip: python3 zlib (Python 3.12.3, zlib 1.3) and Info-ZIP UnZip 6.0 / Zip 3.0. Their output is committed under corpus/ with the commands that made it (corpus/SOURCES.txt), so the gate itself needs only the pinned omc. corpus/refuse/ORACLE.txt has the oracle's verdict on each refusal fixture. tests/mkcases.om (Omega) regenerates corpus/refuse.

Exit codes

Every refusal writes one line ozip: MESSAGE to stderr. Output already written to stdout before a refusal stays written (the stream is not buffered whole); with x the partly written file is removed.

codemeaningzlib's message for the same input (python3) or UnZip
0done
1usage, bad arguments
2cannot open the zip file
3read error
4write error
5x: cannot create an output file or directory (it may exist already: files are opened with O_EXCL and O_NOFOLLOW, never overwritten)
10input ends early (also: empty input)incomplete or truncated stream
11invalid block type (3)invalid block type
12stored block length does not match its complementinvalid stored block lengths
13too many length or distance codes (HLIT > 286 or HDIST > 30)too many length or distance symbols
14code-length code over-subscribed or incompleteinvalid code lengths set
15code-length repeat with no previous length, or past the endinvalid bit length repeat
16literal/length code lengths over-subscribed or incomplete (one code of length 1 is admitted)invalid literal/lengths set
17distance code lengths over-subscribed or incomplete (likewise)invalid distances set
18no end-of-block code (symbol 256 has length 0)invalid code -- missing end-of-block
19invalid literal/length code (286, 287, or no code)invalid literal/length code
20invalid distance code (30, 31, or no code)invalid distance code
21distance too far back (before the start of the output)invalid distance too far back
22output above the bound (4294967295 bytes per stream; CRC-32 input above 2^40 bytes)
30bad zlib header (method not 8, window above 32 KiB, check bits)incorrect header check / unknown compression method / invalid window size
31zlib preset dictionaryError 2 (Z_NEED_DICT)
32Adler-32 mismatchincorrect data check
40no end of central directory record (not a zip file)
41ZIP64 archive: not yet supported
42split or spanned archiveUnZip warns and tries anyway
43encrypted entryUnZip asks for a password
44compression method other than 0 and 8
45x: unsafe name (absolute, .., ., empty part, backslash, NUL), or output path above 4095 bytesUnZip strips ../ with a warning
46local header or data descriptor disagrees with the central directorystricter than unzip -t
47CRC-32 mismatchbad CRC
48entry larger than the bound (1 GiB)
49no entry with that name
50central directory malformed (signature, count, size, offsets)
51entries overlap: their local headers and data need more bytes than lie before the central directory (an overlapping zip bomb)UnZip: "invalid zip file with overlapped components (possible zip bomb)"
52stored entry with different compressed and uncompressed sizes
53entry data longer or shorter than its stated sizestricter than unzip -t

A trap (exit 101..114) would be a defect: the gate fails on one.

Bounds, and what happens at each

Nothing holds a whole file. All storage is fixed: 57 globals, 64,124 bytes in all (a 32 KiB window that is also the output buffer, a 16 KiB input buffer, Huffman tables, a 4 KiB name, a 4 KiB wanted name, a 4 KiB output path), plus at most 12,376 bytes of local arrays. No array has more than 32,768 elements, so the sizes of profile rule B3 (seed/profile/README.md: 65,536 elements per array, 65,536 bytes of globals) hold. The B1 loop-bound rule (every bound at most 8192) is not met: streaming a file of up to 4 GiB in one pass needs outer loops above 8192 passes, so the unit is not profiled.

boundvalueat the bound
window (distance)32768 bytes (RFC 1951)a larger distance cannot be coded
output per raw or zlib stream4294967295 bytesrefused, 22 (bytes before it already written)
CRC-32 input2^40 bytesrefused, 22
zip entry, uncompressed1073741824 bytes (1 GiB)refused before any output, 48
zip entry output vs its stated sizeexactly the stated sizerefused, 53
entries' local headers, names and data, summed over the archive (t, p, x)at most the bytes before the central directory, so the output is bounded by DEFLATE's ratio times the archive sizerefused before any output, 51
zip entries65535 (no ZIP64)0xFFFF means ZIP64: 41
archive comment65535 bytes (the end record is searched in the last 65557 bytes)not found: 40
entry name4095 bytes45
x path DIR/NAME4095 bytes (Linux PATH_MAX - 1)45
ZIP path argument, DIR argument4095 bytes1
directoriesmade with mode 0755; files 0644

Not supported (refused, never guessed)

ZIP64 (not yet supported: 41), encryption (43), split or spanned archives (42), methods other than stored and deflated (44: no BZIP2, LZMA, Deflate64, ...), archives with data before the first entry (self-extractors: the offsets no longer match, 50), zip symbolic links and file modes (an entry is written as a plain file with mode 0644), archive comments in t/p/x are ignored, gzip files (use ozip inflate after the gzip header is removed). ozip p NAME takes the exact name, without UnZip's wildcards. The l/v listings are equal to UnZip's for archives whose entries carry no extended-timestamp extra field (UnZip then prints that time in the local time zone; omega-zip prints the MS-DOS date and time fields) and whose names are printable ASCII (control bytes are shown as ^ and the byte plus 64, as UnZip does). Output files are not given the archive's timestamps.

Measured speed

MEASURED 2026-11-10T04:53Z on the Spark (DGX Spark GB10, Linux AArch64), one core: taskset -c 8 inside the hive's pool-8-9 ticket, nice -n 10, load average about 20 on the machine. ozip built by the gate (sha256 3687bb9d...981d76); wall time of /usr/bin/time (0.01 s resolution), the same in each of 3 runs; MiB per second of uncompressed output (Wolfram: 64/0.47, 64/0.28, 128/0.99, 64/0.13).

commandinputtimethroughput
ozip inflatetext64M.raw6: 64 MiB of OMEGESE.md repeated, python3 zlib level 6 raw, 25,504,782 bytes0.47 s136.2 MiB/s out (51.8 MiB/s in)
ozip inflatebin64M.raw6: 64 MiB of omc repeated, level 6 raw, 14,554,550 bytes0.28 s228.6 MiB/s
ozip ttp.zip: both files, zip -6, 40,051,393 bytes, CRC-32 checked0.99 s129.3 MiB/s
ozip crc32text64M0.13 s492.3 MiB/s

The output bound was exercised once outside the gate (it needs 4 GiB of output): 4294967296 zero bytes compressed at level 9 (4,174,507 bytes) gave ozip: output above the bound, exit 22, after 5.99 s. The inputs are made by commands in the scratch directory and not committed; they are not part of the corpus. Huffman codes are decoded one bit at a time (simple to read, not the fastest way).

Standards followed

  • RFC 1951, DEFLATE Compressed Data Format Specification version 1.3 (sections 2, 3.2.1 to 3.2.7).
  • RFC 1950, ZLIB Compressed Data Format Specification version 3.3 (sections 2.2 and 8.2, Adler-32).
  • PKWARE APPNOTE.TXT, .ZIP File Format Specification, version 6.3.10 (sections 4.3.6 to 4.3.16, 4.4).
  • CRC-32: the polynomial of ISO 3309 and ITU-T V.42 (0x04C11DB7, reflected 0xEDB88320), register preset to all ones and inverted at the end, as APPNOTE 4.4.7 and RFC 1952 section 8 specify.
  • SHA-256 in the gate: FIPS 180-4.

Files

  • src/: the units (head, io, crc32, inflate, zlibd, unzip, main).
  • Reuse: another program can take io.om, crc32.om, inflate.om, zlibd.om and unzip.om unchanged. Their output goes through w = wout n (the window win[0 .. n)), which the program defines as fn wout n ulong to ulong, returning n: src/main.om passes it to woutfd in io.om (the output descriptor); omega-office's src/sink.om consumes it. Without a wout omc refuses the program (error 3).
  • vendor/omega-mv/seed/text/text.om: omega-mv's text unit, unchanged (NOTICE, PIN).
  • tests/gate.om, tests/cases.txt, tests/mutants.txt, tests/mkcases.om.
  • corpus/: originals, oracle outputs, refusal fixtures; sources and licences in corpus/SOURCES.txt.

Licence

Apache-2.0 (LICENSE). The LibreOffice templates in corpus/zip are MPL-2.0 test data (NOTICE).

For developers: proof and records

The full record of this project. Words that are used only here are explained once:

ID
The project's permanent id on Interplane: the SHA-256 of its first signed record. This one is git:8a8eb182e2c53e891e5322a2d013d430a10228540c81ac026bdd6e1cd9f21676. Its old id, kept only so that old links still work: z2Hxzn2TdMYH5oHb18ZYpP1ZY2SSb.
Owner
The key that signs every record of the project. This forge lists the project under drakestapleton; its key is SHA256:qg3vxoE9ul3Cgk5heosQvPmO9pqIJNsdcsGJ2cHghTs.
Refs and HEAD
Refs are the names that point at versions: branches and tags. HEAD is the version a fresh copy starts from, the newest commit of the default branch.
Patch
A proposed change, reviewed before it is merged. This forge does not show proposed changes from its own store yet. The list is under Proposed changes.
Receipt
A public record that someone checked a claim, with the fingerprint of its evidence file. The state at the top of this page is read from the list at interplane.io/receipts. This project has no receipt in that list yet.

Clones and fetches over HTTPS: 0 by visitors (git smart-HTTP info/refs requests answered 200 in the front-door download log; our own addresses and bots left out; since 2026-11-08) · not measured git-upload-pack requests from all clients (the source of this count is retired)

Downloads: 1 by visitors (1 source archives, 0 release assets; forged access log; our own addresses left out; since 2026-11-07)

commit 68c1a0c7d035e639c34ff181eccf3d58496f3338 Branches Tags History
68c1a0c docs: retire the hand-made Chinese README; readers translate with their own tools Drake Stapleton committed 2026-11-11
corpus/
src/
tests/
vendor/
.gitignore7
.goals.json1458
LICENSE11358
NOTICE448
PIN390
README.md12907

Every record: History (commits) · Branches · Tags · Releases, with the SHA-256 of each download · Patches · Issues · This project as JSON