mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8223174: Pattern.compile() can throw confusing NegativeArraySizeException
Reviewed-by: martin
This commit is contained in:
parent
a8e13a5839
commit
b7ea7e93aa
2 changed files with 49 additions and 1 deletions
|
@ -1678,7 +1678,13 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
|
|||
return;
|
||||
int j = i;
|
||||
i += 2;
|
||||
int[] newtemp = new int[j + 3*(pLen-i) + 2];
|
||||
int newTempLen;
|
||||
try {
|
||||
newTempLen = Math.addExact(j + 2, Math.multiplyExact(3, pLen - i));
|
||||
} catch (ArithmeticException ae) {
|
||||
throw new OutOfMemoryError();
|
||||
}
|
||||
int[] newtemp = new int[newTempLen];
|
||||
System.arraycopy(temp, 0, newtemp, 0, j);
|
||||
|
||||
boolean inQuote = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue