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`.

-------------

Commit messages:
 - Also verify number of ZipFile::entries and count of ZipFile::stream.
 - Add test to verify ZipFile:size with incorrect ENDTOT fields

Changes: https://git.openjdk.org/jdk/pull/29635/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29635&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8377461
  Stats: 116 lines in 1 file changed: 116 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/29635.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29635/head:pull/29635

PR: https://git.openjdk.org/jdk/pull/29635

Reply via email to