# HG changeset patch # User twisti # Date 1292935050 28800 # Node ID ef3c5db0b3ae951fbff7b7a3e8f916f88affe1b4 # Parent 1fb0500f550e28e948bc48ad4d6f8116ba674937 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 diff -r 1fb0500f550e -r ef3c5db0b3ae src/share/vm/classfile/classFileParser.cpp --- a/src/share/vm/classfile/classFileParser.cpp Sat Dec 18 08:38:07 2010 -0800 +++ b/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); } }