Cover the DEFLATE path and stop malformed zips raising #5
Reference in New Issue
Block a user
Delete Branch "benvin/deflate-tests"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The suite never drove a byte through the vendored inflate, leaving the riskiest part of the extractor untested, and several malformed-archive paths raised a raw Lua error where every other failure returns
nil, err.zipbinarynil, errfor a directory colliding with a file and for a zero-length pax recordReviewed the diff, ran
make test/lint/fmt-check/pre-commit(all green, 146/146 locally with tar/zip/unzip/gzip present, 129/146 with them stripped from PATH — matches the body's claim, and the 17 gap is entirely pre-existing installer/init cases untouched by this PR). Verifiedtests/deflate.luaindependently: decompressed its fixed- and dynamic-Huffman, empty, 400KB, and overlapping-copy streams with Python'szlib.decompressobj(-15)andgzip— all byte-exact and standards-compliant. Mutation-tested the hardening: reverting each of the fournil,errconversions (CD/local-header bounds, mkdir-collision, size check) makes the corresponding new regression test fail with the original raise/mismatch, as expected. Scope matches the body (tests + archive.lua error paths only, no vendored-library edits).Two things to fix before merge:
1.
tests/archive_spec.lua:640("stops a pax record that claims a zero length") — the regression test hangs indefinitely rather than failing.Confirmed by removing the guard at
lua/arti-pack/archive.lua:286-288and running justmake test: thenvim --headlessprocess pins at 100% CPU and never returns (killed it manually after 2+ minutes).tests/harness.lua'sM.itis a barepcallwith no time bound, and none of the.woodpecker/*.yamlsteps set atimeout:. A future regression of this guard won't show up as a failing test — it'll silently stall the wholeteststep (blocking every other test's result along with it) until Woodpecker's global job timeout eventually kills it. Please bound this specific test (e.g.debug.sethookwith an instruction-count limit to force a controlled error if the loop runs away, or drivepax_recordsdirectly with an iteration cap) so a regression here fails fast instead of hanging CI.2. PR description violates the repo's PR-body convention.
Current body is 12 lines / 1636 characters; the cap is 10 lines and 800 characters. It also closes with a verification-narrative paragraph ("The suite still passes with
zip,tarandunzipoff PATH: 129 of 146 run there...") which the convention explicitly excludes. Please trim to one short why-paragraph plus present-tense bullets, and drop the trailing pass/skip-count paragraph (that belongs in the PR conversation, not the description).Everything else — the DEFLATE encoder, the error-path hardening, and
archive_root/extraction behavior for well-formed archives (unchanged, not touched by this diff) — looks correct.