FULL PRODUCT VERSION :
A DESCRIPTION OF THE PROBLEM :
We used a SOOT's jimple file to generate a java class code. We executed the class using Hotspot and gcj-java, and found that the result can be different. After checking the class file and the jimple file, I believed that the type inference system used in hotspot verifier can be enhanced.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes
REGRESSION. Last worked in version 7u75
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
(1) transform the jimple file to a class file
(2) run the class file on hotspot or using gcj-java, and compare the results.
EXPECTED VERSUS ACTUAL BEHAVIOR :
The type inference system can report a type incompatible problem, because I guess that the type-casting between String and map can be unsafe.
command: java M1433982529S
Hotspot 7/8/9: (Nothing)
Gcj-java 4.8: Exception in thread "main" java.lang.NoClassDefFoundError: M1433982529S
at java.lang.Class.initializeClass(libgcj.so.14)
Caused by: java.lang.VerifyError: verification failed at PC 1 in M1433982529S:internalTransform((Ljava.lang.String;)V): incompatible type on stack
at java.lang.Class.initializeClass(libgcj.so.14)
ERROR MESSAGES/STACK TRACES THAT OCCUR :
No crash
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
The jimple file is: ( notice that @parameter0 is of a type java.lang.String )
public class M1433982529S extends java.lang.Object
{
protected void internalTransform(java.lang.String)
{
java.util.Map r0;
r0 := @parameter0: java.util.Map;
staticinvoke <java.lang.Object: boolean getBoolean(java.util.Map)>(r0);
return;
}
}
The class file:
Last modified Jun 16, 2015; size 280 bytes
MD5 checksum bac669ea75d85888d7af44741aee2cf5
Compiled from "Jasmin"
public class M1433982529S
minor version: 0
major version: 46
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
#1 = Utf8 java/lang/Object
#2 = Utf8 SourceFile
#3 = Utf8 main
#4 = Methodref #15.#13 // java/lang/Object.getBoolean:(Ljava/util/Map;)Z
#5 = Utf8 Code
#6 = Class #12 // M1433982529S
#7 = Utf8 getBoolean
#8 = Utf8 ([Ljava/lang/String;)V
#9 = Utf8 Jasmin
#10 = Utf8 internalTransform
#11 = Utf8 (Ljava/util/Map;)Z
#12 = Utf8 M1433982529S
#13 = NameAndType #7:#11 // getBoolean:(Ljava/util/Map;)Z
#14 = Utf8 (Ljava/lang/String;)V
#15 = Class #1 // java/lang/Object
{
public static void main(java.lang.String[]);
descriptor: ([Ljava/lang/String;)V
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=0, locals=1, args_size=1
0: return
protected void internalTransform(java.lang.String);
descriptor: (Ljava/lang/String;)V
flags: ACC_PROTECTED
Code:
stack=1, locals=2, args_size=2
0: aload_1
1: invokestatic #4 // Method java/lang/Object.getBoolean:(Ljava/util/Map;)Z
4: pop
5: return
}
SourceFile: "Jasmin"
---------- END SOURCE ----------
A DESCRIPTION OF THE PROBLEM :
We used a SOOT's jimple file to generate a java class code. We executed the class using Hotspot and gcj-java, and found that the result can be different. After checking the class file and the jimple file, I believed that the type inference system used in hotspot verifier can be enhanced.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes
REGRESSION. Last worked in version 7u75
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
(1) transform the jimple file to a class file
(2) run the class file on hotspot or using gcj-java, and compare the results.
EXPECTED VERSUS ACTUAL BEHAVIOR :
The type inference system can report a type incompatible problem, because I guess that the type-casting between String and map can be unsafe.
command: java M1433982529S
Hotspot 7/8/9: (Nothing)
Gcj-java 4.8: Exception in thread "main" java.lang.NoClassDefFoundError: M1433982529S
at java.lang.Class.initializeClass(libgcj.so.14)
Caused by: java.lang.VerifyError: verification failed at PC 1 in M1433982529S:internalTransform((Ljava.lang.String;)V): incompatible type on stack
at java.lang.Class.initializeClass(libgcj.so.14)
ERROR MESSAGES/STACK TRACES THAT OCCUR :
No crash
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
The jimple file is: ( notice that @parameter0 is of a type java.lang.String )
public class M1433982529S extends java.lang.Object
{
protected void internalTransform(java.lang.String)
{
java.util.Map r0;
r0 := @parameter0: java.util.Map;
staticinvoke <java.lang.Object: boolean getBoolean(java.util.Map)>(r0);
return;
}
}
The class file:
Last modified Jun 16, 2015; size 280 bytes
MD5 checksum bac669ea75d85888d7af44741aee2cf5
Compiled from "Jasmin"
public class M1433982529S
minor version: 0
major version: 46
flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
#1 = Utf8 java/lang/Object
#2 = Utf8 SourceFile
#3 = Utf8 main
#4 = Methodref #15.#13 // java/lang/Object.getBoolean:(Ljava/util/Map;)Z
#5 = Utf8 Code
#6 = Class #12 // M1433982529S
#7 = Utf8 getBoolean
#8 = Utf8 ([Ljava/lang/String;)V
#9 = Utf8 Jasmin
#10 = Utf8 internalTransform
#11 = Utf8 (Ljava/util/Map;)Z
#12 = Utf8 M1433982529S
#13 = NameAndType #7:#11 // getBoolean:(Ljava/util/Map;)Z
#14 = Utf8 (Ljava/lang/String;)V
#15 = Class #1 // java/lang/Object
{
public static void main(java.lang.String[]);
descriptor: ([Ljava/lang/String;)V
flags: ACC_PUBLIC, ACC_STATIC
Code:
stack=0, locals=1, args_size=1
0: return
protected void internalTransform(java.lang.String);
descriptor: (Ljava/lang/String;)V
flags: ACC_PROTECTED
Code:
stack=1, locals=2, args_size=2
0: aload_1
1: invokestatic #4 // Method java/lang/Object.getBoolean:(Ljava/util/Map;)Z
4: pop
5: return
}
SourceFile: "Jasmin"
---------- END SOURCE ----------
- duplicates
-
JDK-8130468 A class having a low version number is not checked carefully
-
- Closed
-