Mercurial > hg > release > icedtea7-forest-2.5 > hotspot
changeset 5501:c650f71b9c67
8036800: Attribute OOM to correct part of code
Summary: checks that the attribute_length does not exceed the length of remaining data in the class file
Reviewed-by: coleenp, ahgross
author | hseigel |
---|---|
date | Wed, 19 Mar 2014 14:18:19 -0400 |
parents | f9dfc73ddf90 |
children | 458f18560343 |
files | src/share/vm/classfile/classFileParser.cpp |
diffstat | 1 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/vm/classfile/classFileParser.cpp Tue Mar 18 13:08:04 2014 -0700 +++ b/src/share/vm/classfile/classFileParser.cpp Wed Mar 19 14:18:19 2014 -0400 @@ -2654,18 +2654,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: // length*{bootstrap_method_index, argument_count*{argument_index}}