Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8328267

ZipFileSystem does not respect jdk.util.zip.disableZip64ExtraFieldValidation

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      Since JDK 21 a bunch of ZIP64 validation code has been added to ZipFileSystem, but unlike ZipFile it does not respect the property `jdk.util.zip.disableZip64ExtraFieldValidation` that was previously used to switch off the extra validation and allow programs to continue to work with malformed zip files that happened to work.

      REGRESSION : Last worked in version 21.0.2

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      You will need: the AspectJ Weaver jar from https://mvnrepository.com/artifact/org.aspectj/aspectjweaver/1.8.9

      Consider source program:

      ```
      import java.nio.file.spi.FileSystemProvider;
      import java.nio.file.Path;
      import java.util.Map;

      public class Test {

        public static void main(String[] args) {

          try {
            for (var provider : FileSystemProvider.installedProviders()) {
              if (provider.getScheme().equals("jar"))
                provider.newFileSystem(Path.of(args[0]), Map.of());
            }
          } catch (Exception e) { throw new RuntimeException(e); }

        }

      }
      ```

      Running `java Test aspectjweaver-1.8.9.jar` works under JDK21 but not 22 (or the latest build of 23).

      `ZipFile` provides the property `jdk.util.zip.disableZip64ExtraFieldValidation` to override this behaviour, but `ZipFileSystem` ignores it, leaving no recourse to restore compatibility with zips that cannot easily be replaced, did not cause any trouble, but are technically malformed.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Respect the jdk.util.zip.disableZip64ExtraFieldValidation flag.
      ACTUAL -
      jdk.util.zip.disableZip64ExtraFieldValidation flag has no effect.

      ---------- BEGIN SOURCE ----------
      See above.
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      None.

      FREQUENCY : always


            bpb Brian Burkhalter
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: