JDK-8031691 : Crash in Zipfile.GetEntry
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.jar
  • Affected Version: 6u38
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_10
  • Submitted: 2014-01-14
  • Updated: 2016-08-05
  • Resolved: 2016-08-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8-poolResolved
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Description
JVM died by SIGSEGV at ZipFile.getEntry.  
Stack: [0xffff80ffb296e000,0xffff80ffb2a6e000],  sp=0xffff80ffb2a6b078,  free space=1012k 
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) 
C  [libc.so.1+0x8d4fe]  memcpy+0x135e C  [libzip.so+0xe121]  ZIP_GetEntry+0x91 
C  [libzip.so+0x4ef1]  Java_java_util_zip_ZipFile_getEntry+0xa1 J  java.util.zip.ZipFile.getEntry(JLjava/lang/String;Z)J  


testcase present 
The java sources are in testcase.tar. 
CrashTest.java is very simple: 
======================================================= 
package mypkg1; 

import java.io.IOException; 
public class CrashTest { 
public static boolean loadClass(String cname) { 
    try { 
            System.out.println("loading class :" + cname); 
            Class.forName(cname); 
            System.out.println("loading class :" + cname + " done."); 
            return(true); 
    } catch (ClassNotFoundException e) { 
      System.out.println("failed to load class '" + cname + "': " + e); 
    } return(false); 
}  

/** 
  * param args 
  */ 
public static void main(String[] args) { 
    if (! loadClass("mypkg2.MyClass1")) { 
       System.out.println("loadClass failed.");  
       return; 
    } 
    System.out.println("Press enter to continue..."); 
    try {  
        System.in.read();  
    } catch (IOException e) { 
        return; 
    }  
    if (! loadClass("mypkg2.MyClass2")) { 
       System.out.println("loadClass failed."); 
       return; 
    } 
    System.out.println("main done"); 
 } 
} 

 ======================================================= 
This program does:
 load mypkg2.MyClass1
 wait for keyboard input
 load mypkg2.MyClass2

mypkg2.MyClass1 and mypkg2.MyClass2 are in mypkg2_v1.jar and mypkg2_v2.jar:
=======================================================
# jar tvf mypkg2_v1.jar
     0 Mon Sep 02 09:45:30 KST 2013 META-INF/
    71 Mon Sep 02 09:45:30 KST 2013 META-INF/MANIFEST.MF
   681 Mon Sep 02 09:45:30 KST 2013 mypkg2/MyClass1.class
   681 Mon Sep 02 09:45:30 KST 2013 mypkg2/MyClass2.class
# jar tvf mypkg2_v2.jar
     0 Mon Sep 02 09:45:30 KST 2013 META-INF/
    71 Mon Sep 02 09:45:30 KST 2013 META-INF/MANIFEST.MF
   734 Mon Sep 02 09:45:30 KST 2013 mypkg2/MyClass1.class
   734 Mon Sep 02 09:45:30 KST 2013 mypkg2/MyClass2.class
=======================================================

If CrashTest is run without changing the jar file (ie. if you skip step 3)
there is no problem.
Comments
Checking with submitter if this can be closed out. I'm not sure if such a large change is feasible for update release. JDK 9 EA binaries available at : https://jdk9.java.net/download/
04-08-2016

Fixed in JDK 9 via JDK-8145260 - Submitter's code will now more than likely throw a ZipException.
04-08-2016

removing comments I added yesterday. They were added by error. I was thinking of another bug (JDK-6907252) where I will add these comments. Will remove reproducer testcase from this bug report also.
20-06-2014

Resolving as incomplete until the affects Version/s field is filled out.
14-01-2014

Affects 6u38 onwards
14-01-2014