mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8246788: ZoneRules invariants can be broken
Reviewed-by: rriggs, naoto
This commit is contained in:
parent
874aef4a8f
commit
a8871776e6
2 changed files with 90 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -259,10 +259,12 @@ public final class ZoneRules implements Serializable {
|
|||
}
|
||||
|
||||
// last rules
|
||||
if (lastRules.size() > 16) {
|
||||
Object[] temp = lastRules.toArray();
|
||||
ZoneOffsetTransitionRule[] rulesArray = Arrays.copyOf(temp, temp.length, ZoneOffsetTransitionRule[].class);
|
||||
if (rulesArray.length > 16) {
|
||||
throw new IllegalArgumentException("Too many transition rules");
|
||||
}
|
||||
this.lastRules = lastRules.toArray(new ZoneOffsetTransitionRule[lastRules.size()]);
|
||||
this.lastRules = rulesArray;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue