-
Type:
Bug
-
Resolution: Fixed
-
Priority:
P3
-
Affects Version/s: 25
-
Component/s: hotspot
-
b23
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
If class has 65535 entries in the constant pool, VM will reserve one more entry for hidden class name, resulting in a crash.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the program.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
VM throws some exception.
ACTUAL -
VM crashes.
---------- BEGIN SOURCE ----------
import org.objectweb.asm.ClassWriter;
import java.lang.invoke.MethodHandles;
import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
import static org.objectweb.asm.Opcodes.V17;
public class HiddenClassesTest {
public static void main(String[] args) throws Exception {
var cw = new ClassWriter(0);
cw.visit(V17, ACC_PUBLIC, "Hidden", null, "java/lang/Object", null);
for (int i = 0; i < 65530; i++) {
cw.newUTF8(Integer.toString(i));
}
MethodHandles.lookup().defineHiddenClass(cw.toByteArray(), false);
}
}
---------- END SOURCE ----------
If class has 65535 entries in the constant pool, VM will reserve one more entry for hidden class name, resulting in a crash.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the program.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
VM throws some exception.
ACTUAL -
VM crashes.
---------- BEGIN SOURCE ----------
import org.objectweb.asm.ClassWriter;
import java.lang.invoke.MethodHandles;
import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
import static org.objectweb.asm.Opcodes.V17;
public class HiddenClassesTest {
public static void main(String[] args) throws Exception {
var cw = new ClassWriter(0);
cw.visit(V17, ACC_PUBLIC, "Hidden", null, "java/lang/Object", null);
for (int i = 0; i < 65530; i++) {
cw.newUTF8(Integer.toString(i));
}
MethodHandles.lookup().defineHiddenClass(cw.toByteArray(), false);
}
}
---------- END SOURCE ----------
- links to
-
Commit(master)
openjdk/jdk/6f452ac4
-
Review(master)
openjdk/jdk/27964