mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
Merge
This commit is contained in:
commit
4616c13c2f
67 changed files with 1126 additions and 799 deletions
|
@ -3053,6 +3053,7 @@ static int inner_classes_jump_to_outer(const Array<u2>* inner_classes, int inner
|
|||
static bool inner_classes_check_loop_through_outer(const Array<u2>* inner_classes, int idx, const ConstantPool* cp, int length) {
|
||||
int slow = inner_classes->at(idx + InstanceKlass::inner_class_inner_class_info_offset);
|
||||
int fast = inner_classes->at(idx + InstanceKlass::inner_class_outer_class_info_offset);
|
||||
|
||||
while (fast != -1 && fast != 0) {
|
||||
if (slow != 0 && (cp->klass_name_at(slow) == cp->klass_name_at(fast))) {
|
||||
return true; // found a circularity
|
||||
|
@ -3082,14 +3083,15 @@ bool ClassFileParser::check_inner_classes_circularity(const ConstantPool* cp, in
|
|||
for (int y = idx + InstanceKlass::inner_class_next_offset; y < length;
|
||||
y += InstanceKlass::inner_class_next_offset) {
|
||||
|
||||
// To maintain compatibility, throw an exception if duplicate inner classes
|
||||
// entries are found.
|
||||
guarantee_property((_inner_classes->at(idx) != _inner_classes->at(y) ||
|
||||
_inner_classes->at(idx+1) != _inner_classes->at(y+1) ||
|
||||
_inner_classes->at(idx+2) != _inner_classes->at(y+2) ||
|
||||
_inner_classes->at(idx+3) != _inner_classes->at(y+3)),
|
||||
"Duplicate entry in InnerClasses attribute in class file %s",
|
||||
CHECK_(true));
|
||||
// 4347400: make sure there's no duplicate entry in the classes array
|
||||
if (_major_version >= JAVA_1_5_VERSION) {
|
||||
guarantee_property((_inner_classes->at(idx) != _inner_classes->at(y) ||
|
||||
_inner_classes->at(idx+1) != _inner_classes->at(y+1) ||
|
||||
_inner_classes->at(idx+2) != _inner_classes->at(y+2) ||
|
||||
_inner_classes->at(idx+3) != _inner_classes->at(y+3)),
|
||||
"Duplicate entry in InnerClasses attribute in class file %s",
|
||||
CHECK_(true));
|
||||
}
|
||||
// Return true if there are two entries with the same inner_class_info_index.
|
||||
if (_inner_classes->at(y) == _inner_classes->at(idx)) {
|
||||
return true;
|
||||
|
@ -3182,10 +3184,9 @@ u2 ClassFileParser::parse_classfile_inner_classes_attribute(const ClassFileStrea
|
|||
inner_classes->at_put(index++, inner_access_flags.as_short());
|
||||
}
|
||||
|
||||
// 4347400: make sure there's no duplicate entry in the classes array
|
||||
// Also, check for circular entries.
|
||||
// Check for circular and duplicate entries.
|
||||
bool has_circularity = false;
|
||||
if (_need_verify && _major_version >= JAVA_1_5_VERSION) {
|
||||
if (_need_verify) {
|
||||
has_circularity = check_inner_classes_circularity(cp, length * 4, CHECK_0);
|
||||
if (has_circularity) {
|
||||
// If circularity check failed then ignore InnerClasses attribute.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue