< prev index next >

src/share/vm/classfile/classFileParser.cpp

Print this page

        

@@ -1264,10 +1264,14 @@
           "Invalid Deprecated field attribute length %u in class file %s",
           attribute_length, CHECK);
       }
     } 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",
             attribute_length, CHECK);
         }

@@ -2585,10 +2589,15 @@
           "Invalid Deprecated method attribute length %u in class file %s",
           method_attribute_length, CHECK_NULL);
       }
     } 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",
             method_attribute_length, CHECK_NULL);
         }

@@ -3232,10 +3241,11 @@
   u2 attributes_count = cfs->get_u2_fast();
   bool parsed_sourcefile_attribute = false;
   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;
   int runtime_invisible_annotations_length = 0;
   const u1* runtime_visible_type_annotations = NULL;

@@ -3304,15 +3314,20 @@
           "Invalid Deprecated classfile attribute length %u in class file %s",
           attribute_length, CHECK);
       }
     } 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) {
           classfile_parse_error(
             "Multiple RuntimeVisibleAnnotations attributes in class file %s", CHECK);
< prev index next >