Skip to content

test: native-gzip concatenated-member-count cap (1000) regression — 1001 minimal members → exact 'too many concatenated members' rejection + 1000-member passing boundary (ZipTest/NativeGzip.lean; distinct from output-size cap #2577 / header-trailer fuzz #2584 / framing guards #2590) #2594

@kim-em

Description

@kim-em

Current state

Zip/Native/Gzip.lean GzipDecode.decompress processes concatenated
gzip members in a bounded loop (for _ in [:1000]) and, if the input
contains more than 1000 members, throws the exact message:

"Gzip: too many concatenated members"

This is a resource-safety (zip-bomb) guard against pathological
many-tiny-member inputs. It is not triggered by any current test:
the multi-member tests (ZipTest/NativeGzip.lean, ZipTest/Gzip.lean)
only build 2–4 members, and #2577 (maxOutputSize small-cap rejection)
exercises the orthogonal output-size cap, not the member-count cap.

Deliverables

  1. A deterministic regression test (in ZipTest/NativeGzip.lean, or a
    small new module if cleaner) that:
    • Builds a concatenation of 1001 minimal valid gzip members
      (e.g. each the gzip encoding of an empty or 1-byte payload via
      Zip.Native.Gzip.compress) in memory.
    • Asserts Zip.Native.GzipDecode.decompress fails with the exact
      substring "too many concatenated members".
    • Includes a passing boundary companion: exactly 1000 members
      still decode successfully (concatenated payload round-trips), so the
      test pins the cap boundary, not just the failure.
  2. Register the module in ZipTest.lean if a new module is added.

Keep the per-member payload tiny so the 1001-member stream stays small
(~20 KB in memory, never written to disk).

Context

Verification

  • lake build and lake exe test pass (from project root; NixOS uses
    the nix-shell --run wrapper).
  • The 1001-member case fails with the asserted substring; the 1000-member
    case succeeds and round-trips to the concatenated payload.
  • grep -rc sorry Zip/ unchanged (0).

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-planAgent work planfeatureImplementation work; claimed by /feature agents

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions