Mercurial > hg > graal-compiler
comparison src/share/vm/classfile/classFileParser.cpp @ 17558:9b289963cb9a jdk8u5-b12
8034926: Attribute classes properly
Summary: Add check to prevent underflow
Reviewed-by: coleenp, ahgross
author | hseigel |
---|---|
date | Thu, 20 Feb 2014 13:30:59 -0500 |
parents | e254e5940c19 |
children | 562643f42b65 5f7e12f5b4e5 a18dafb24f80 |
comparison
equal
deleted
inserted
replaced
17557:c96a3381e55e | 17558:9b289963cb9a |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
2775 | 2775 |
2776 guarantee_property(_max_bootstrap_specifier_index < attribute_array_length, | 2776 guarantee_property(_max_bootstrap_specifier_index < attribute_array_length, |
2777 "Short length on BootstrapMethods in class file %s", | 2777 "Short length on BootstrapMethods in class file %s", |
2778 CHECK); | 2778 CHECK); |
2779 | 2779 |
2780 guarantee_property(attribute_byte_length > sizeof(u2), | |
2781 "Invalid BootstrapMethods attribute length %u in class file %s", | |
2782 attribute_byte_length, | |
2783 CHECK); | |
2784 | |
2780 // The attribute contains a counted array of counted tuples of shorts, | 2785 // The attribute contains a counted array of counted tuples of shorts, |
2781 // represending bootstrap specifiers: | 2786 // represending bootstrap specifiers: |
2782 // length*{bootstrap_method_index, argument_count*{argument_index}} | 2787 // length*{bootstrap_method_index, argument_count*{argument_index}} |
2783 int operand_count = (attribute_byte_length - sizeof(u2)) / sizeof(u2); | 2788 int operand_count = (attribute_byte_length - sizeof(u2)) / sizeof(u2); |
2784 // operand_count = number of shorts in attr, except for leading length | 2789 // operand_count = number of shorts in attr, except for leading length |