Don't assert if class has a bad element_tag in an element_value structure of a RuntimeVisibleAnnotation attribute.  Instead, ignore the attribute.

Reviewed-by: acorn, gtriantafill
This commit is contained in:
Harold Seigel 2015-06-18 08:44:28 -04:00
parent f6fac96205
commit 058dd16f78
4 changed files with 180 additions and 11 deletions

View file

@ -949,8 +949,7 @@ void ClassFileParser::parse_field_attributes(u2 attributes_count,
assert(runtime_visible_annotations != NULL, "null visible annotations");
parse_annotations(runtime_visible_annotations,
runtime_visible_annotations_length,
parsed_annotations,
CHECK);
parsed_annotations);
cfs->skip_u1(runtime_visible_annotations_length, CHECK);
} else if (attribute_name == vmSymbols::tag_runtime_invisible_annotations()) {
if (runtime_invisible_annotations_exists) {
@ -1643,7 +1642,6 @@ int ClassFileParser::skip_annotation_value(u1* buffer, int limit, int index) {
index = skip_annotation(buffer, limit, index);
break;
default:
assert(false, "annotation tag");
return limit; // bad tag byte
}
return index;
@ -1651,8 +1649,7 @@ int ClassFileParser::skip_annotation_value(u1* buffer, int limit, int index) {
// Sift through annotations, looking for those significant to the VM:
void ClassFileParser::parse_annotations(u1* buffer, int limit,
ClassFileParser::AnnotationCollector* coll,
TRAPS) {
ClassFileParser::AnnotationCollector* coll) {
// annotations := do(nann:u2) {annotation}
int index = 0;
if ((index += 2) >= limit) return; // read nann
@ -2280,8 +2277,7 @@ methodHandle ClassFileParser::parse_method(bool is_interface,
runtime_visible_annotations = cfs->get_u1_buffer();
assert(runtime_visible_annotations != NULL, "null visible annotations");
parse_annotations(runtime_visible_annotations,
runtime_visible_annotations_length, &parsed_annotations,
CHECK_(nullHandle));
runtime_visible_annotations_length, &parsed_annotations);
cfs->skip_u1(runtime_visible_annotations_length, CHECK_(nullHandle));
} else if (method_attribute_name == vmSymbols::tag_runtime_invisible_annotations()) {
if (runtime_invisible_annotations_exists) {
@ -2945,8 +2941,7 @@ void ClassFileParser::parse_classfile_attributes(ClassFileParser::ClassAnnotatio
assert(runtime_visible_annotations != NULL, "null visible annotations");
parse_annotations(runtime_visible_annotations,
runtime_visible_annotations_length,
parsed_annotations,
CHECK);
parsed_annotations);
cfs->skip_u1(runtime_visible_annotations_length, CHECK);
} else if (tag == vmSymbols::tag_runtime_invisible_annotations()) {
if (runtime_invisible_annotations_exists) {