On Tue, 1 Dec 2026 17:44:41 GMT, Lance Andersen <[email protected]> wrote:

>> Timofei Fedotov has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Handle oversized ZIP entry names
>
> src/java.base/share/classes/java/util/zip/ZipInputStream.java line 532:
> 
>> 530:         } catch (IllegalArgumentException ex) {
>> 531:             throw (ZipException) new ZipException(
>> 532:                     "invalid LOC header (bad entry 
>> name)").initCause(ex);
> 
> I am assuming the the IAE is due to the call to !isCENHeaderValid(name, 
> extra, comment)?
> 
> If so, I don't see a reason to set the cause in the case.  It is OK, but not 
> really needed.

Done.

> test/jdk/java/util/zip/ZipInputStream/ZipInputStreamExtraLength.java line 49:
> 
>> 47: public class ZipInputStreamExtraLength {
>> 48: 
>> 49:     private static final int LOC_HEADER_SIZE = 30;
> 
> You can use ZipEntry.LOCHDR

Done.

> test/jdk/java/util/zip/ZipInputStream/ZipInputStreamExtraLength.java line 51:
> 
>> 49:     private static final int LOC_HEADER_SIZE = 30;
>> 50: 
>> 51:     private static byte[] localHeader(int nameLength, int extraLength) {
> 
> consider a better name such as initLOCHeader or createLOCHeader

Done.

> test/jdk/java/util/zip/ZipInputStream/ZipInputStreamExtraLength.java line 56:
> 
>> 54:                 .order(ByteOrder.LITTLE_ENDIAN);
>> 55: 
>> 56:         header.putInt(0, 0x04034b50);
> 
> You can use ZipEntry.LOCSIG here

Done.

> test/jdk/java/util/zip/ZipInputStream/ZipInputStreamExtraLength.java line 57:
> 
>> 55: 
>> 56:         header.putInt(0, 0x04034b50);
>> 57:         header.putShort(4, (short) 20);
> 
> Add a comment as to what the Version and general purpose bit flags are

Done.

> test/jdk/java/util/zip/ZipInputStream/ZipInputStreamExtraLength.java line 80:
> 
>> 78: 
>> 79:     @Test
>> 80:     public void oversizedExtraFieldZipInputStream() {
> 
> This should be a @ParameterizedTest

Done.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/34121#discussion_r4765161996
PR Review Comment: https://git.openjdk.org/jdk/pull/34121#discussion_r4765167702
PR Review Comment: https://git.openjdk.org/jdk/pull/34121#discussion_r4765165988
PR Review Comment: https://git.openjdk.org/jdk/pull/34121#discussion_r4765168043
PR Review Comment: https://git.openjdk.org/jdk/pull/34121#discussion_r4765167140
PR Review Comment: https://git.openjdk.org/jdk/pull/34121#discussion_r4765164468

Reply via email to