mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8286070: Improve UTF8 representation
Reviewed-by: bchristi, rhalade
This commit is contained in:
parent
ae0e02766a
commit
ba86c23eaf
1 changed files with 8 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -869,6 +869,13 @@ getStringUTF8(JNIEnv *env, jstring jstr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check `jint` overflow
|
||||||
|
if (rlen < 0) {
|
||||||
|
(*env)->ReleasePrimitiveArrayCritical(env, value, str, 0);
|
||||||
|
JNU_ThrowOutOfMemoryError(env, "requested array size exceeds VM limit");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
result = MALLOC_MIN4(rlen);
|
result = MALLOC_MIN4(rlen);
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
(*env)->ReleasePrimitiveArrayCritical(env, value, str, 0);
|
(*env)->ReleasePrimitiveArrayCritical(env, value, str, 0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue