-
Type:
Enhancement
-
Resolution: Unresolved
-
Priority:
P4
-
Affects Version/s: None
-
Component/s: core-libs
-
None
ZipFile (and other ZIP implementations such as InfoZip/unzip) has some leniency in that it allows padded bytes after the END header.
However, because of the order of validation, ZipFile does not allow this leniency if the ZIP file is a Zip64 file.
Consider:
% echo -n hello | zip zip64.zip - # Create small Zip64 ZIP
% echo trailingbytes >> zip64.zip # Pad with some bytes
% unzip -l zip64.zip # unzip reads this fine
Archive: zip64.zip
Length Date Time Name
--------- ---------- ----- ----
5 02-20-2026 11:11 -
--------- -------
5 1 file
% jar tf zip64.zip
java.util.zip.ZipException: zip END header not found
at java.base/java.util.zip.ZipFile$Source.findEND(ZipFile.java:1693)
at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1701)
at java.base/java.util.zip.ZipFile$Source.<init>(ZipFile.java:1542)
However, because of the order of validation, ZipFile does not allow this leniency if the ZIP file is a Zip64 file.
Consider:
% echo -n hello | zip zip64.zip - # Create small Zip64 ZIP
% echo trailingbytes >> zip64.zip # Pad with some bytes
% unzip -l zip64.zip # unzip reads this fine
Archive: zip64.zip
Length Date Time Name
--------- ---------- ----- ----
5 02-20-2026 11:11 -
--------- -------
5 1 file
% jar tf zip64.zip
java.util.zip.ZipException: zip END header not found
at java.base/java.util.zip.ZipFile$Source.findEND(ZipFile.java:1693)
at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1701)
at java.base/java.util.zip.ZipFile$Source.<init>(ZipFile.java:1542)