Mercurial > hg > graal-jvmci-8
comparison src/share/vm/classfile/classFileParser.cpp @ 2085:ef3c5db0b3ae
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
author | twisti |
---|---|
date | Tue, 21 Dec 2010 04:37:30 -0800 |
parents | dad31fc330cd |
children | 3582bf76420e |
comparison
equal
deleted
inserted
replaced
2084:1fb0500f550e | 2085:ef3c5db0b3ae |
---|---|
2384 u2 argument_count = cfs->get_u2_fast(); | 2384 u2 argument_count = cfs->get_u2_fast(); |
2385 check_property( | 2385 check_property( |
2386 valid_cp_range(bootstrap_method_index, cp_size) && | 2386 valid_cp_range(bootstrap_method_index, cp_size) && |
2387 cp->tag_at(bootstrap_method_index).is_method_handle(), | 2387 cp->tag_at(bootstrap_method_index).is_method_handle(), |
2388 "bootstrap_method_index %u has bad constant type in class file %s", | 2388 "bootstrap_method_index %u has bad constant type in class file %s", |
2389 bootstrap_method_index, | |
2389 CHECK); | 2390 CHECK); |
2390 operands->short_at_put(operand_fill_index++, bootstrap_method_index); | 2391 operands->short_at_put(operand_fill_index++, bootstrap_method_index); |
2391 operands->short_at_put(operand_fill_index++, argument_count); | 2392 operands->short_at_put(operand_fill_index++, argument_count); |
2392 | 2393 |
2393 cfs->guarantee_more(sizeof(u2) * argument_count, CHECK); // argv[argc] | 2394 cfs->guarantee_more(sizeof(u2) * argument_count, CHECK); // argv[argc] |
2394 for (int j = 0; j < argument_count; j++) { | 2395 for (int j = 0; j < argument_count; j++) { |
2395 u2 arg_index = cfs->get_u2_fast(); | 2396 u2 argument_index = cfs->get_u2_fast(); |
2396 check_property( | 2397 check_property( |
2397 valid_cp_range(arg_index, cp_size) && | 2398 valid_cp_range(argument_index, cp_size) && |
2398 cp->tag_at(arg_index).is_loadable_constant(), | 2399 cp->tag_at(argument_index).is_loadable_constant(), |
2399 "argument_index %u has bad constant type in class file %s", | 2400 "argument_index %u has bad constant type in class file %s", |
2401 argument_index, | |
2400 CHECK); | 2402 CHECK); |
2401 operands->short_at_put(operand_fill_index++, arg_index); | 2403 operands->short_at_put(operand_fill_index++, argument_index); |
2402 } | 2404 } |
2403 } | 2405 } |
2404 | 2406 |
2405 assert(operand_fill_index == operands()->length(), "exact fill"); | 2407 assert(operand_fill_index == operands()->length(), "exact fill"); |
2406 assert(constantPoolOopDesc::operand_array_length(operands()) == attribute_array_length, "correct decode"); | 2408 assert(constantPoolOopDesc::operand_array_length(operands()) == attribute_array_length, "correct decode"); |