8286070: Improve UTF8 representation
Reviewed-by: bchristi, rhalade
This commit is contained in:
parent
ae0e02766a
commit
ba86c23eaf
@ -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.
|
||||
*
|
||||
* 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);
|
||||
if (result == NULL) {
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, value, str, 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user