RFR: 8336025: Improve ZipOutputSream validation of MAX CEN Header field limits [v2]

Lance Andersen lancea at openjdk.org
Mon Sep 16 18:25:10 UTC 2024


On Mon, 16 Sep 2024 17:59:11 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Lance Andersen has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update @link ->@linkplain
>
> src/java.base/share/classes/java/util/zip/ZipEntry.java line 44:
> 
>> 42:  * entry comment and {@linkplain #CENHDR CEN Header size}, must not
>> 43:  * exceed 65,535 bytes. If it does, {@linkplain ZipOutputStream} will
>> 44:  * throw a {@linkplain ZipException} when writing the ZIP file entry.
> 
> This looks a little out of place in ZipEntry's class description, does ZOS.putNextEntry throw or is it just finish and close?

Short answer. finish() which calls writeCEN, will throw for the above.

 As the entry comment, is only part of the CEN, I wanted to keep the encoding in writeCEN as there is no reason to do it earlier.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21003#discussion_r1761646379


More information about the core-libs-dev mailing list