mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8297530: java.lang.IllegalArgumentException: Negative length on strings concatenation
Reviewed-by: enikitin, alanb
This commit is contained in:
parent
390e69ad06
commit
87d1097d9b
2 changed files with 141 additions and 2 deletions
|
@ -434,8 +434,11 @@ final class StringConcatHelper {
|
|||
@ForceInline
|
||||
static byte[] newArray(long indexCoder) {
|
||||
byte coder = (byte)(indexCoder >> 32);
|
||||
int index = (int)indexCoder;
|
||||
return (byte[]) UNSAFE.allocateUninitializedArray(byte.class, index << coder);
|
||||
int index = ((int)indexCoder) << coder;
|
||||
if (index < 0) {
|
||||
throw new OutOfMemoryError("Overflow: String length out of range");
|
||||
}
|
||||
return (byte[]) UNSAFE.allocateUninitializedArray(byte.class, index);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue