On Wed, 2 Dec 2026 14:10:09 GMT, Timofei Fedotov <[email protected]> wrote:

>> ZipInputStream.readLOC() calls ZipEntry.setExtra0() without translating 
>> IllegalArgumentException into ZipException. setExtra0() rejects a local 
>> entry when the combined central-header size, entry name, and extra field 
>> exceeds 65535 bytes.
>> 
>> For example, an empty entry name with an extra-field length of 65490 causes 
>> IllegalArgumentException from getNextEntry(). The same input also causes the 
>> JarInputStream constructor to throw the unchecked exception instead of its 
>> documented IOException.
>> 
>> Malformed local headers should be rejected with ZipException. The exception 
>> translation should cover both entry creation and extra-field processing so 
>> that all invalid LOC length combinations follow the public IOException 
>> contract.
>> 
>> ---------
>> - [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:
> 
>   Use non-empty ZIP entry names in regression tests

I think we are getting closer.

For test comments, we are hoping for a bit more.  see  
open/test/jdk/java/util/zip/ZipFile/DupEntriesGetInputStream.java, 
open/test/jdk/java/util/zip/ZipInputStream/Zip64DataDescriptor.java or 
open/test/jdk/jdk/nio/zipfs/ZipFSMaxCenHdrTest.java for inspiration

test/jdk/java/util/zip/ZipInputStream/ZipInputStreamExtraLength.java line 28:

> 26:  * @bug 8398547
> 27:  * @summary Reject oversized LOC name and extra fields with ZipException
> 28:  * @run junit ZipInputStreamExtraLength

Could change as Jai suggested to

`@run junit ${test.main.class}`

This is something that we are trying to remember (including me :-) )

test/jdk/java/util/zip/ZipInputStream/ZipInputStreamExtraLength.java line 93:

> 91:         // Process a LOC with an oversized extra field.
> 92:         expectZipException(extraLength);
> 93:     }

Why not just make expectException(with a better testName as Jai mentioned for 
tests)  be the actual ParameterizedTest

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

PR Review: https://git.openjdk.org/jdk/pull/34121#pullrequestreview-6152854838
PR Review Comment: https://git.openjdk.org/jdk/pull/34121#discussion_r4771577863
PR Review Comment: https://git.openjdk.org/jdk/pull/34121#discussion_r4771205287

Reply via email to