8286331: jni_GetStringUTFChars() uses wrong heap allocator

Reviewed-by: dlong, stuefe
This commit is contained in:
Zhengyu Gu 2022-05-09 19:46:03 +00:00
parent 902b1dd455
commit b0d2b0a355
2 changed files with 3 additions and 3 deletions

View File

@ -2233,7 +2233,7 @@ JNI_ENTRY(const char*, jni_GetStringUTFChars(JNIEnv *env, jstring string, jboole
if (s_value != NULL) {
size_t length = java_lang_String::utf8_length(java_string, s_value);
/* JNI Specification states return NULL on OOM */
result = AllocateHeap(length + 1, mtInternal, 0, AllocFailStrategy::RETURN_NULL);
result = AllocateHeap(length + 1, mtInternal, AllocFailStrategy::RETURN_NULL);
if (result != NULL) {
java_lang_String::as_utf8_string(java_string, s_value, result, (int) length + 1);
if (isCopy != NULL) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 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
@ -64,7 +64,7 @@ public:
memset(_stack, 0, sizeof(_stack));
}
NativeCallStack(int toSkip);
explicit NativeCallStack(int toSkip);
NativeCallStack(address* pc, int frameCount);
static inline const NativeCallStack& empty_stack() { return _empty_stack; }