RFR: 8272746: ZipFile can't open big file (NegativeArraySizeException) [v2]

Masanori Yano myano at openjdk.java.net
Fri Dec 24 11:07:05 UTC 2021


On Thu, 23 Dec 2021 16:42:50 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Masanori Yano has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8272746: ZipFile can't open big file (NegativeArraySizeException)
>
> src/java.base/share/classes/java/util/zip/ZipFile.java line 1501:
> 
>> 1499:                 // read in the CEN and END
>> 1500:                 if (end.cenlen + ENDHDR >= Integer.MAX_VALUE) {
>> 1501:                     zerror("invalid END header (too large central directory size)");
> 
> This check looks correct. It might be a bit clearer to say that "central directory size too large" rather than "too large central directory size".
> 
> The bug report says that JDK 8 and the native zip handle these zip files, were you able to check that?

I will correct the message as you pointed out.

I checked the JDK8 and Linux unzip commands and found no exceptions or errors. Since JDK9, [JDK-8145260](https://bugs.openjdk.java.net/browse/JDK-8145260) has been modified to significantly change the way zip files are handled, resulting in a different result than jdk8.

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

PR: https://git.openjdk.java.net/jdk/pull/6927


More information about the core-libs-dev mailing list