comparison src/share/vm/classfile/classFileParser.cpp @ 18056:3b0fe4ec6ebe

8041717: Issue with class file parser Summary: Add better checking for bad values. Reviewed-by: coleenp, lfoltan, mschoene
author hseigel
date Fri, 30 May 2014 13:32:43 -0400
parents f0d759a6a230
children b207affc0618
comparison
equal deleted inserted replaced
18055:1fa005fb28f5 18056:3b0fe4ec6ebe
2824 valid_cp_range(bootstrap_method_index, cp_size) && 2824 valid_cp_range(bootstrap_method_index, cp_size) &&
2825 _cp->tag_at(bootstrap_method_index).is_method_handle(), 2825 _cp->tag_at(bootstrap_method_index).is_method_handle(),
2826 "bootstrap_method_index %u has bad constant type in class file %s", 2826 "bootstrap_method_index %u has bad constant type in class file %s",
2827 bootstrap_method_index, 2827 bootstrap_method_index,
2828 CHECK); 2828 CHECK);
2829
2830 guarantee_property((operand_fill_index + 1 + argument_count) < operands->length(),
2831 "Invalid BootstrapMethods num_bootstrap_methods or num_bootstrap_arguments value in class file %s",
2832 CHECK);
2833
2829 operands->at_put(operand_fill_index++, bootstrap_method_index); 2834 operands->at_put(operand_fill_index++, bootstrap_method_index);
2830 operands->at_put(operand_fill_index++, argument_count); 2835 operands->at_put(operand_fill_index++, argument_count);
2831 2836
2832 cfs->guarantee_more(sizeof(u2) * argument_count, CHECK); // argv[argc] 2837 cfs->guarantee_more(sizeof(u2) * argument_count, CHECK); // argv[argc]
2833 for (int j = 0; j < argument_count; j++) { 2838 for (int j = 0; j < argument_count; j++) {
2841 operands->at_put(operand_fill_index++, argument_index); 2846 operands->at_put(operand_fill_index++, argument_index);
2842 } 2847 }
2843 } 2848 }
2844 2849
2845 assert(operand_fill_index == operands->length(), "exact fill"); 2850 assert(operand_fill_index == operands->length(), "exact fill");
2846 assert(ConstantPool::operand_array_length(operands) == attribute_array_length, "correct decode");
2847 2851
2848 u1* current_end = cfs->current(); 2852 u1* current_end = cfs->current();
2849 guarantee_property(current_end == current_start + attribute_byte_length, 2853 guarantee_property(current_end == current_start + attribute_byte_length,
2850 "Bad length on BootstrapMethods in class file %s", 2854 "Bad length on BootstrapMethods in class file %s",
2851 CHECK); 2855 CHECK);