7008165: Garbage in ClassFormatError message
Summary: When bootstrap_method_ref in BootstrapMethods attribute points to a wrong CP entry (non-MethodHandle), JVM throws ClassFormatError with a message, where method index and class file name is garbage.
Reviewed-by: iveresov
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp Sat Dec 18 08:38:07 2010 -0800
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp Tue Dec 21 04:37:30 2010 -0800
@@ -2386,19 +2386,21 @@
valid_cp_range(bootstrap_method_index, cp_size) &&
cp->tag_at(bootstrap_method_index).is_method_handle(),
"bootstrap_method_index %u has bad constant type in class file %s",
+ bootstrap_method_index,
CHECK);
operands->short_at_put(operand_fill_index++, bootstrap_method_index);
operands->short_at_put(operand_fill_index++, argument_count);
cfs->guarantee_more(sizeof(u2) * argument_count, CHECK); // argv[argc]
for (int j = 0; j < argument_count; j++) {
- u2 arg_index = cfs->get_u2_fast();
+ u2 argument_index = cfs->get_u2_fast();
check_property(
- valid_cp_range(arg_index, cp_size) &&
- cp->tag_at(arg_index).is_loadable_constant(),
+ valid_cp_range(argument_index, cp_size) &&
+ cp->tag_at(argument_index).is_loadable_constant(),
"argument_index %u has bad constant type in class file %s",
+ argument_index,
CHECK);
- operands->short_at_put(operand_fill_index++, arg_index);
+ operands->short_at_put(operand_fill_index++, argument_index);
}
}