--- old/src/share/vm/classfile/classFileParser.cpp 2017-03-07 08:30:36.482168830 -0500 +++ new/src/share/vm/classfile/classFileParser.cpp 2017-03-07 08:30:36.209237671 -0500 @@ -1266,6 +1266,10 @@ } } else if (_major_version >= JAVA_1_5_VERSION) { if (attribute_name == vmSymbols::tag_signature()) { + if (generic_signature_index != 0) { + classfile_parse_error( + "Multiple Signature attributes for field in class file %s", CHECK); + } if (attribute_length != 2) { classfile_parse_error( "Wrong size %u for field's Signature attribute in class file %s", @@ -2587,6 +2591,11 @@ } } else if (_major_version >= JAVA_1_5_VERSION) { if (method_attribute_name == vmSymbols::tag_signature()) { + if (generic_signature_index != 0) { + classfile_parse_error( + "Multiple Signature attributes for method in class file %s", + CHECK_NULL); + } if (method_attribute_length != 2) { classfile_parse_error( "Invalid Signature attribute length %u in class file %s", @@ -3234,6 +3243,7 @@ bool parsed_innerclasses_attribute = false; bool parsed_enclosingmethod_attribute = false; bool parsed_bootstrap_methods_attribute = false; + bool signature_exists = false; const u1* runtime_visible_annotations = NULL; int runtime_visible_annotations_length = 0; const u1* runtime_invisible_annotations = NULL; @@ -3306,11 +3316,16 @@ } } else if (_major_version >= JAVA_1_5_VERSION) { if (tag == vmSymbols::tag_signature()) { + if (signature_exists) { + classfile_parse_error( + "Multiple Signature attributes in class file %s", CHECK); + } if (attribute_length != 2) { classfile_parse_error( "Wrong Signature attribute length %u in class file %s", attribute_length, CHECK); } + signature_exists = true; parse_classfile_signature_attribute(cfs, CHECK); } else if (tag == vmSymbols::tag_runtime_visible_annotations()) { if (runtime_visible_annotations != NULL) {