Tue, 21 Dec 2010 04:37:30 -0800
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
src/share/vm/classfile/classFileParser.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/classfile/classFileParser.cpp Sat Dec 18 08:38:07 2010 -0800 1.2 +++ b/src/share/vm/classfile/classFileParser.cpp Tue Dec 21 04:37:30 2010 -0800 1.3 @@ -2386,19 +2386,21 @@ 1.4 valid_cp_range(bootstrap_method_index, cp_size) && 1.5 cp->tag_at(bootstrap_method_index).is_method_handle(), 1.6 "bootstrap_method_index %u has bad constant type in class file %s", 1.7 + bootstrap_method_index, 1.8 CHECK); 1.9 operands->short_at_put(operand_fill_index++, bootstrap_method_index); 1.10 operands->short_at_put(operand_fill_index++, argument_count); 1.11 1.12 cfs->guarantee_more(sizeof(u2) * argument_count, CHECK); // argv[argc] 1.13 for (int j = 0; j < argument_count; j++) { 1.14 - u2 arg_index = cfs->get_u2_fast(); 1.15 + u2 argument_index = cfs->get_u2_fast(); 1.16 check_property( 1.17 - valid_cp_range(arg_index, cp_size) && 1.18 - cp->tag_at(arg_index).is_loadable_constant(), 1.19 + valid_cp_range(argument_index, cp_size) && 1.20 + cp->tag_at(argument_index).is_loadable_constant(), 1.21 "argument_index %u has bad constant type in class file %s", 1.22 + argument_index, 1.23 CHECK); 1.24 - operands->short_at_put(operand_fill_index++, arg_index); 1.25 + operands->short_at_put(operand_fill_index++, argument_index); 1.26 } 1.27 } 1.28