mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
7008165: Garbage in ClassFormatError message
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
This commit is contained in:
parent
af3cf83d37
commit
e970ef6182
1 changed files with 6 additions and 4 deletions
|
@ -2386,19 +2386,21 @@ void ClassFileParser::parse_classfile_bootstrap_methods_attribute(constantPoolHa
|
||||||
valid_cp_range(bootstrap_method_index, cp_size) &&
|
valid_cp_range(bootstrap_method_index, cp_size) &&
|
||||||
cp->tag_at(bootstrap_method_index).is_method_handle(),
|
cp->tag_at(bootstrap_method_index).is_method_handle(),
|
||||||
"bootstrap_method_index %u has bad constant type in class file %s",
|
"bootstrap_method_index %u has bad constant type in class file %s",
|
||||||
|
bootstrap_method_index,
|
||||||
CHECK);
|
CHECK);
|
||||||
operands->short_at_put(operand_fill_index++, bootstrap_method_index);
|
operands->short_at_put(operand_fill_index++, bootstrap_method_index);
|
||||||
operands->short_at_put(operand_fill_index++, argument_count);
|
operands->short_at_put(operand_fill_index++, argument_count);
|
||||||
|
|
||||||
cfs->guarantee_more(sizeof(u2) * argument_count, CHECK); // argv[argc]
|
cfs->guarantee_more(sizeof(u2) * argument_count, CHECK); // argv[argc]
|
||||||
for (int j = 0; j < argument_count; j++) {
|
for (int j = 0; j < argument_count; j++) {
|
||||||
u2 arg_index = cfs->get_u2_fast();
|
u2 argument_index = cfs->get_u2_fast();
|
||||||
check_property(
|
check_property(
|
||||||
valid_cp_range(arg_index, cp_size) &&
|
valid_cp_range(argument_index, cp_size) &&
|
||||||
cp->tag_at(arg_index).is_loadable_constant(),
|
cp->tag_at(argument_index).is_loadable_constant(),
|
||||||
"argument_index %u has bad constant type in class file %s",
|
"argument_index %u has bad constant type in class file %s",
|
||||||
|
argument_index,
|
||||||
CHECK);
|
CHECK);
|
||||||
operands->short_at_put(operand_fill_index++, arg_index);
|
operands->short_at_put(operand_fill_index++, argument_index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue