Mercurial > hg > graal-jvmci-8
comparison src/share/vm/classfile/classFileParser.cpp @ 17574:5f7e12f5b4e5
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:02:51 -0400 |
parents | 9b289963cb9a |
children | f0d759a6a230 |
comparison
equal
deleted
inserted
replaced
17573:aff11567504c | 17574:5f7e12f5b4e5 |
---|---|
2768 | 2768 |
2769 void ClassFileParser::parse_classfile_bootstrap_methods_attribute(u4 attribute_byte_length, TRAPS) { | 2769 void ClassFileParser::parse_classfile_bootstrap_methods_attribute(u4 attribute_byte_length, TRAPS) { |
2770 ClassFileStream* cfs = stream(); | 2770 ClassFileStream* cfs = stream(); |
2771 u1* current_start = cfs->current(); | 2771 u1* current_start = cfs->current(); |
2772 | 2772 |
2773 cfs->guarantee_more(2, CHECK); // length | |
2774 int attribute_array_length = cfs->get_u2_fast(); | |
2775 | |
2776 guarantee_property(_max_bootstrap_specifier_index < attribute_array_length, | |
2777 "Short length on BootstrapMethods in class file %s", | |
2778 CHECK); | |
2779 | |
2780 guarantee_property(attribute_byte_length > sizeof(u2), | 2773 guarantee_property(attribute_byte_length > sizeof(u2), |
2781 "Invalid BootstrapMethods attribute length %u in class file %s", | 2774 "Invalid BootstrapMethods attribute length %u in class file %s", |
2782 attribute_byte_length, | 2775 attribute_byte_length, |
2776 CHECK); | |
2777 | |
2778 cfs->guarantee_more(attribute_byte_length, CHECK); | |
2779 | |
2780 int attribute_array_length = cfs->get_u2_fast(); | |
2781 | |
2782 guarantee_property(_max_bootstrap_specifier_index < attribute_array_length, | |
2783 "Short length on BootstrapMethods in class file %s", | |
2783 CHECK); | 2784 CHECK); |
2784 | 2785 |
2785 // The attribute contains a counted array of counted tuples of shorts, | 2786 // The attribute contains a counted array of counted tuples of shorts, |
2786 // represending bootstrap specifiers: | 2787 // represending bootstrap specifiers: |
2787 // length*{bootstrap_method_index, argument_count*{argument_index}} | 2788 // length*{bootstrap_method_index, argument_count*{argument_index}} |