hotspot/src/share/vm/classfile/classFileParser.cpp
changeset 25506 fb0b78b7bca6
parent 25470 4e69740b1547
child 25507 37c0bd9e16a0
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Mon Jul 14 12:45:14 2014 +0400
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Mon Jul 14 13:01:34 2014 +0400
@@ -2798,17 +2798,19 @@
   ClassFileStream* cfs = stream();
   u1* current_start = cfs->current();
 
-  cfs->guarantee_more(2, CHECK);  // length
+  guarantee_property(attribute_byte_length >= sizeof(u2),
+                     "Invalid BootstrapMethods attribute length %u in class file %s",
+                     attribute_byte_length,
+                     CHECK);
+
+  cfs->guarantee_more(attribute_byte_length, CHECK);
+
   int attribute_array_length = cfs->get_u2_fast();
 
   guarantee_property(_max_bootstrap_specifier_index < attribute_array_length,
                      "Short length on BootstrapMethods in class file %s",
                      CHECK);
 
-  guarantee_property(attribute_byte_length >= sizeof(u2),
-                     "Invalid BootstrapMethods attribute length %u in class file %s",
-                     attribute_byte_length,
-                     CHECK);
 
   // The attribute contains a counted array of counted tuples of shorts,
   // represending bootstrap specifiers: