8044738: Check attribute_length of EnclosingMethod attribute

Add check that attribute_length == 4.

Reviewed-by: fparain, coleenp, lfoltan
This commit is contained in:
Harold Seigel 2014-06-10 14:04:37 -04:00
parent 1510b7c75e
commit 70c76ec8c4
4 changed files with 166 additions and 1 deletions

View file

@ -2984,9 +2984,12 @@ void ClassFileParser::parse_classfile_attributes(ClassFileParser::ClassAnnotatio
} else if (tag == vmSymbols::tag_enclosing_method()) {
if (parsed_enclosingmethod_attribute) {
classfile_parse_error("Multiple EnclosingMethod attributes in class file %s", CHECK);
} else {
} else {
parsed_enclosingmethod_attribute = true;
}
guarantee_property(attribute_length == 4,
"Wrong EnclosingMethod attribute length %u in class file %s",
attribute_length, CHECK);
cfs->guarantee_more(4, CHECK); // class_index, method_index
enclosing_method_class_index = cfs->get_u2_fast();
enclosing_method_method_index = cfs->get_u2_fast();