RFR: 8377461: Add ZipFile test for incorrect number of entries reported in ENDTOT [v2]
Lance Andersen
lancea at openjdk.org
Wed Feb 11 09:28:47 UTC 2026
On Tue, 10 Feb 2026 06:05:15 GMT, Eirik Bjørsnøs <eirbjo at openjdk.org> wrote:
>> Please review this PR introducing a test to verify that `ZipFile::size` reports the actual number of CEN entries in a ZIP file, despite an incorrect number being reported in the END header.
>>
>> Background:
>>
>> The `ZipFile` implementation treats `ENDTOT` as an indication, but falls back to counting CEN entries if this number is too low. After parsing the CEN, there is also code to adjust the total down to the actual count of CEN entries.
>>
>> The behavior of always reporting the actual number of CEN entries has no current test coverage in the JDK. It seems good to have tests excercising these code paths and protecting against regressions in this area.
>>
>> Verification:
>>
>> Verified that the new test catches introduced regressions in handling over- and underreported numbers in ENDTOT and that no existing test catches such regressions.
>>
>> Test-only change, `noreg-self`.
>
> Eirik Bjørsnøs has updated the pull request incrementally with two additional commits since the last revision:
>
> - Add case: Empty ZIP, correct ENDTOT
> - Copyright 2026 for new test
Marked as reviewed by lancea (Reviewer).
-------------
PR Review: https://git.openjdk.org/jdk/pull/29635#pullrequestreview-3780655590
More information about the core-libs-dev
mailing list