comparison src/share/vm/classfile/classFileParser.cpp @ 20353:72fa1e83e5f9

8051002: Incorrectly merged share/vm/classfile/classFileParser.cpp was pushed to 8u20. Summary: Correct fix for allowing BootstrapMethods attribute with an empty bootstrap_methods table. Reviewed-by: coleenp, ctornqvi, hseigel
author lfoltan
date Mon, 25 Aug 2014 15:57:10 -0400
parents 9f169829d0e1
children 6e0cb14ce59b
comparison
equal deleted inserted replaced
20350:c3990b8c710e 20353:72fa1e83e5f9
2778 2778
2779 void ClassFileParser::parse_classfile_bootstrap_methods_attribute(u4 attribute_byte_length, TRAPS) { 2779 void ClassFileParser::parse_classfile_bootstrap_methods_attribute(u4 attribute_byte_length, TRAPS) {
2780 ClassFileStream* cfs = stream(); 2780 ClassFileStream* cfs = stream();
2781 u1* current_start = cfs->current(); 2781 u1* current_start = cfs->current();
2782 2782
2783 guarantee_property(attribute_byte_length > sizeof(u2), 2783 guarantee_property(attribute_byte_length >= sizeof(u2),
2784 "Invalid BootstrapMethods attribute length %u in class file %s", 2784 "Invalid BootstrapMethods attribute length %u in class file %s",
2785 attribute_byte_length, 2785 attribute_byte_length,
2786 CHECK); 2786 CHECK);
2787 2787
2788 cfs->guarantee_more(attribute_byte_length, CHECK); 2788 cfs->guarantee_more(attribute_byte_length, CHECK);
2789 2789
2790 int attribute_array_length = cfs->get_u2_fast(); 2790 int attribute_array_length = cfs->get_u2_fast();
2791 2791
2792 guarantee_property(_max_bootstrap_specifier_index < attribute_array_length, 2792 guarantee_property(_max_bootstrap_specifier_index < attribute_array_length,
2793 "Short length on BootstrapMethods in class file %s", 2793 "Short length on BootstrapMethods in class file %s",
2794 CHECK);
2795
2796 guarantee_property(attribute_byte_length >= sizeof(u2),
2797 "Invalid BootstrapMethods attribute length %u in class file %s",
2798 attribute_byte_length,
2799 CHECK); 2794 CHECK);
2800 2795
2801 // The attribute contains a counted array of counted tuples of shorts, 2796 // The attribute contains a counted array of counted tuples of shorts,
2802 // represending bootstrap specifiers: 2797 // represending bootstrap specifiers:
2803 // length*{bootstrap_method_index, argument_count*{argument_index}} 2798 // length*{bootstrap_method_index, argument_count*{argument_index}}