changeset 5395:761de5506390

8041717: Issue with class file parser Summary: Add better checking for bad values. Reviewed-by: coleenp, lfoltan, mschoene
author hseigel
date Fri, 30 May 2014 13:38:44 -0400
parents fa1a8360ff78
children a3b8e785348d
files src/share/vm/classfile/classFileParser.cpp
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/classFileParser.cpp	Wed May 28 10:08:39 2014 -0700
+++ b/src/share/vm/classfile/classFileParser.cpp	Fri May 30 13:38:44 2014 -0400
@@ -2721,6 +2721,11 @@
       "bootstrap_method_index %u has bad constant type in class file %s",
       bootstrap_method_index,
       CHECK);
+
+    guarantee_property((operand_fill_index + 1 + argument_count) < operands->length(),
+      "Invalid BootstrapMethods num_bootstrap_methods or num_bootstrap_arguments value in class file %s",
+      CHECK);
+
     operands->short_at_put(operand_fill_index++, bootstrap_method_index);
     operands->short_at_put(operand_fill_index++, argument_count);
 
@@ -2738,7 +2743,6 @@
   }
 
   assert(operand_fill_index == operands()->length(), "exact fill");
-  assert(constantPoolOopDesc::operand_array_length(operands()) == attribute_array_length, "correct decode");
 
   u1* current_end = cfs->current();
   guarantee_property(current_end == current_start + attribute_byte_length,