Cover the DEFLATE path and stop malformed zips raising #5

Merged
benvin merged 5 commits from benvin/deflate-tests into main 2026-09-11 22:31:01 +10:00

5 Commits

Author SHA1 Message Date
unkin-agent 15383b8cce Bound every test with a wall-clock timeout
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
A runaway test spins at full CPU instead of failing, stalling the whole
run. A debug hook enforces a per-test deadline; the JIT stays off so the
hook is reachable from compiled code.
2026-09-11 00:00:20 +10:00
unkin-agent 27b182f1c3 Report a directory that collides with a file
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
vim.fn.mkdir raises when a path component is an existing file, and an
archive can arrange that by shipping a file and then a path under it.
Return nil, err from mkdirp and propagate it.
2026-09-10 23:30:48 +10:00
unkin-agent 11c8fbf485 Aim the truncated-directory test at the raising path
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
A record whose name is cut short already reported; the raise needed a
zero-length name and a directory offset pointing into the trailing
comment. Build that case instead.
2026-09-10 23:27:22 +10:00
unkin-agent 78a5df6cf3 Test the DEFLATE path with real compressed fixtures
The fixture builder only produced stored entries, so the vendored inflate
never ran under test. Add a small DEFLATE encoder and drive zip and
tar.gz entries through it: round-trips for fixed and dynamic huffman,
empty and large payloads, plus wrong CRC, wrong stated size, truncated
and corrupted streams, and a traversal name on a compressed entry.

Also cover the central directory and local header truncations that used
to raise.
2026-09-10 23:27:22 +10:00
unkin-agent 407ad8093f Report malformed zip headers instead of raising
A central directory record or local header cut short of its length fields
made zip_entries and zip_data do arithmetic on nil, so the parse raised
where every other failure returns nil, err. Bound both against the buffer
first. A pax record claiming a zero length no longer spins forever.
2026-09-10 23:27:22 +10:00