On Wed, 2 Dec 2026 05:40:54 GMT, Timofei Fedotov <[email protected]> wrote:

>> ZipFile reads the ZIP64 central directory size as a signed 64-bit value but 
>> does not reject negative values before allocating the central directory 
>> buffer. Values from -45 through -1 pass the existing consistency checks and 
>> cause NegativeArraySizeException in new byte[cenlen].
>> 
>> A minimal 99-byte ZIP64 structure reproduces the issue with ZipFile and 
>> JarFile. The same malformed archive also affects URLClassLoader and the 
>> zipfs FileSystem implementation, which contains equivalent parsing logic. 
>> ZipInputStream is unaffected because it does not read the central directory.
>> 
>> Negative ZIP64 sizes and offsets should be rejected with ZipException or 
>> IOException during header validation rather than causing an unchecked 
>> allocation exception.
>> 
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Timofei Fedotov has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Address ZIP64 regression test review comments

Updates to ZipFile and ZipFileSystem looks good. I note the test has been 
extended to test cenoff < 0, thanks.  I see Lance has several comments on the 
test so wait for his approval before you integrate.

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

Marked as reviewed by alanb (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/34122#pullrequestreview-6147676104

Reply via email to