On Fri, 29 Mar 2024 18:28:37 GMT, Jiangli Zhou <jian...@openjdk.org> wrote:

>> Liam Miller-Cushon has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Maximum Zip64 extra field length is 32
>
> src/java.base/share/native/libjli/parse_manifest.c line 506:
> 
>> 504:               jlong offset = 0;
>> 505:               while (offset < cenext) {
>> 506:                 short headerId = ZIPEXT_HDR(base + offset);
> 
> This block of code is very similar to the corresponding part (reading the 
> ZIP64 extension extra fields) in `validate_lochdr`. Perhaps also refractor to 
> a common helper function?

The other loop uses `readAt` to read in additional data and advance through the 
extra fields, this loop already has access to a buffer that contains all of the 
data for the extra fields and doesn't need to do that.

I considered having the other loop read in all of the data for the extra fields 
so there could be a shared helper, but the data is variable length, so that 
would have required having a large fixed-size buffer or allocating memory, 
which this code seems to be trying to avoid.

Do you see a good way to share the loop?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18479#discussion_r1544768965

Reply via email to