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

java.util.zip.ZipUtils.get16() throws java.lang.ArrayIndexOutOfBoundsException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: P3 P3
    • None
    • 8
    • core-libs

      FULL PRODUCT VERSION :
      java version "1.8.0"
      Java(TM) SE Runtime Environment (build 1.8.0-b132)
      Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Linux thomola 2.6.32-55-generic #117-Ubuntu SMP Tue Dec 3 17:31:12 UTC 2013 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      Using java.util.zip package to unzip zip file created in SAP system the unzip process fail see below, for example when a zip any data in on my ubuntu it's fine. I didn't find to submit failed zip file, so I can send it in advance if requested.

      REGRESSION. Last worked in version 7u40


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 24
      at java.util.zip.ZipUtils.get16(ZipUtils.java:103)
      at java.util.zip.ZipEntry.setExtra0(ZipEntry.java:455)
      at java.util.zip.ZipInputStream.readLOC(ZipInputStream.java:322)
      at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:122)
      at TestZip.unzip(TestZip.java:34)
      at TestZip.main(TestZip.java:113)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.BufferedInputStream;
      import java.io.File;
      import java.io.FileInputStream;
      import java.io.FileNotFoundException;
      import java.io.IOException;
      import java.io.InputStream;
      import java.util.zip.ZipEntry;
      import java.util.zip.ZipInputStream;
      import java.util.zip.ZipOutputStream;

      public class TestZip {
        void unzip(File zipFile) throws IOException {
          ZipInputStream zipIn = null;
          try {
            zipIn = new ZipInputStream(new BufferedInputStream(new FileInputStream(zipFile)));
            ZipEntry entry;
            while ((entry = zipIn.getNextEntry()) != null) {
                      System.out.println(entry.getName());


              zipIn.closeEntry();
            }
         }
         finally {
                      try {zipIn.close();}
                      catch(Exception ignore) {}
              }
          }
         public static void main(String[] args) throws IOException {
          System.out.println("main...");
          if(args.length != 1) {
            System.out.println("usage param[0]=zip");
            System.exit(1);
          }

          new TestZip().unzip(new File(args[0]));
        }
      }

      ---------- END SOURCE ----------

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: