From a83321c25efa41f4ec1a5ed6f078c974fc09db0d Mon Sep 17 00:00:00 2001 From: hseigel Date: Fri, 30 May 2014 13:32:43 -0400 Subject: [PATCH] 8041717: Issue with class file parser Summary: Add better checking for bad values. Reviewed-by: coleenp, lfoltan, mschoene --- src/share/vm/classfile/classFileParser.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/share/vm/classfile/classFileParser.cpp b/src/share/vm/classfile/classFileParser.cpp index b499ef94c..159724a00 100644 --- a/src/share/vm/classfile/classFileParser.cpp +++ b/src/share/vm/classfile/classFileParser.cpp @@ -2826,6 +2826,11 @@ void ClassFileParser::parse_classfile_bootstrap_methods_attribute(u4 attribute_b "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->at_put(operand_fill_index++, bootstrap_method_index); operands->at_put(operand_fill_index++, argument_count); @@ -2843,7 +2848,6 @@ void ClassFileParser::parse_classfile_bootstrap_methods_attribute(u4 attribute_b } assert(operand_fill_index == operands->length(), "exact fill"); - assert(ConstantPool::operand_array_length(operands) == attribute_array_length, "correct decode"); u1* current_end = cfs->current(); guarantee_property(current_end == current_start + attribute_byte_length, -- GitLab