You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ZIP64 read-side defensiveness in bundle_locator + archive_io #65
Follow-up from epic #40 / DESIGN_DECISIONS §9. ZIP64 was called out as
"out of scope" — config trees are kilobytes, but a defensive reader
should still handle the format gracefully.
Scope
Two surfaces to make ZIP64-defensive:
`bundle_locator` — when a ZIP exceeds 4 GiB or has > 65535
entries, the EOCD's cd_size / cd_offset / entry-count fields are
set to sentinel `0xffff` / `0xffffffff` values and the real
values live in the ZIP64 EOCD record (which sits before the
ZIP64 EOCD locator, which sits before the regular EOCD). Currently
`bundle_locator.cpp` rejects EOCDs with sentinel fields as
"malformed".
`archive_io` — libarchive already handles ZIP64 on read. Just
verify our round-trip tests don't accidentally trip the boundary
(a fixture with > 65535 entries would exercise this).
Practical bound: nobody will pack a > 4 GiB config tree, but a
hostile or accidentally-grown bundle should fail with "ZIP64 not
supported" instead of "no bundle present" (which is what happens
today and is misleading).
Acceptance
`bundle_locator` recognises ZIP64 sentinel fields and either:
reads the ZIP64 EOCD locator + record and returns a correct
`BundleLocation`, OR
returns `nullopt` plus logs a single-line WARNING naming the
ZIP64-vs-non-ZIP64 mismatch (lower-effort fallback).
2 new test cases in `test/cpp/bundle_locator_test.cpp` with
synthetic ZIP64-shaped fixtures.
References
DESIGN_DECISIONS §9 "Out of scope"
v26.05.23 release notes "Out of scope" section
ZIP APPNOTE.TXT § 4.5 (ZIP64 extra field) and § 4.3.16 (Zip64 EOCD)
src/bundle_locator.cpp:89-94 performs range validation that implicitly rejects the ZIP64 sentinel values (cd_size > eocd_file_offset and cd_offset_arch > cd_file_offset both fail for 0xffffffff against any plausible flapi binary).
test/cpp/bundle_locator_test.cpp:122-150 ("rejects an EOCD with implausible fields") already exercises cd_size=0xffffffff / cd_offset_arch=0xffffffff and asserts REQUIRE_FALSE(loc.has_value()).
src/archive_io.cpp is libarchive-backed, so the read side handles ZIP64 transparently if it ever sees one.
What is still missing — and is all that needs to ship to close this issue:
A single-line WARN log in bundle_locator when sentinel fields are detected, naming "ZIP64-vs-non-ZIP64 mismatch" so the failure mode is no longer indistinguishable from "no bundle present" in operator logs.
Renaming / re-titling the existing test case to explicitly mention ZIP64 (the test exists but is named generically), and adding a second test for sentinel entry-count (0xffff) to round out coverage of all three sentinel fields.
The full ZIP64 EOCD locator (0x06064b50) + ZIP64 EOCD parser is not required. Config bundles will never approach 4 GiB; a clear log line at the rejection point is sufficient and matches the "lower-effort fallback" already called out in the acceptance criteria.
Activity
jrosskopf commentedon May 25, 2026
Scope-narrowing note after auditing current code:
The defensive rejection part is already in place:
src/bundle_locator.cpp:89-94performs range validation that implicitly rejects the ZIP64 sentinel values (cd_size > eocd_file_offsetandcd_offset_arch > cd_file_offsetboth fail for0xffffffffagainst any plausible flapi binary).test/cpp/bundle_locator_test.cpp:122-150("rejects an EOCD with implausible fields") already exercisescd_size=0xffffffff/cd_offset_arch=0xffffffffand assertsREQUIRE_FALSE(loc.has_value()).src/archive_io.cppis libarchive-backed, so the read side handles ZIP64 transparently if it ever sees one.What is still missing — and is all that needs to ship to close this issue:
bundle_locatorwhen sentinel fields are detected, naming "ZIP64-vs-non-ZIP64 mismatch" so the failure mode is no longer indistinguishable from "no bundle present" in operator logs.0xffff) to round out coverage of all three sentinel fields.The full ZIP64 EOCD locator (0x06064b50) + ZIP64 EOCD parser is not required. Config bundles will never approach 4 GiB; a clear log line at the rejection point is sufficient and matches the "lower-effort fallback" already called out in the acceptance criteria.
Will tackle this after #63.
feat(self-packaging #65): ZIP64-sentinel WARN log in bundle_locator (#68