RFR: 8303866: Allow ZipInputStream.readEnd to parse small Zip64 ZIP files [v15]
Eirik Bjørsnøs
eirbjo at openjdk.org
Mon Feb 5 13:14:39 UTC 2024
On Mon, 5 Feb 2024 12:31:37 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> Eirik Bjørsnøs has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 228 commits:
>>
>> - Merge branch 'master' into data-descriptor
>> - Update comment of expect64BitDataDescriptor to reflect relaxed validation
>> - Dial down validation of the Zip64 extra field
>> - 8321712: C2: "failed: Multiple uses of register" in C2_MacroAssembler::vminmax_fp
>>
>> Co-authored-by: Volodymyr Paprotski <vpaprotski at openjdk.org>
>> Reviewed-by: kvn, thartmann, epeter, jbhateja
>> - 8319128: sun/security/pkcs11 tests fail on OL 7.9 aarch64
>>
>> Reviewed-by: mbaesken
>> - 8322971: KEM.getInstance() should check if a 3rd-party security provider is signed
>>
>> Reviewed-by: mullan, valeriep
>> - 8320890: [AIX] Find a better way to mimic dl handle equality
>>
>> Reviewed-by: stuefe, mdoerr
>> - 8323276: StressDirListings.java fails on AIX
>>
>> Reviewed-by: jpai, dfuchs
>> - 8319793: C2 compilation fails with "Bad graph detected in build_loop_late" after JDK-8279888
>>
>> Reviewed-by: chagedorn, epeter
>> - 8314515: java/util/concurrent/SynchronousQueue/Fairness.java failed with "Error: fair=false i=8 j=0"
>>
>> Reviewed-by: alanb
>> - ... and 218 more: https://git.openjdk.org/jdk/compare/e10d1400...4af7f500
>
> test/jdk/java/util/zip/ZipInputStream/Zip64DataDescriptor.java line 270:
>
>> 268: try (ZipInputStream in = new ZipInputStream(new ByteArrayInputStream(zip))) {
>> 269: ZipEntry e;
>> 270: while ( (e = in.getNextEntry()) != null) {
>
> The zip is expected to have a single ZipEntry. Would it be better to do something like this, so that if the ZipEntry is missing, then the test fails?
>
> (I haven't tested this code below)
>
>
> ZipEntry e = in.getNextEntry();
> assertNotNull(e, "missing zip entry");
> assertEquals("hello\n", new String(in.readAllBytes(), StandardCharsets.UTF_8));
> assertNull(in.getNextEntry(), "unexpected additional zip entry");
Thanks @jaikiran, I updated the method based on your suggesion, and also added some comments to help explain what happens where. Perhaps useful for someone not intimately familiar with ZipInputStream.
I'll hold on integrating this until Lance finds time to have a final look.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/12524#discussion_r1478219071
More information about the core-libs-dev
mailing list