Skip to content

Commit 3d32a20

Browse files
committed
8286331: jni_GetStringUTFChars() uses wrong heap allocator
Backport-of: b0d2b0a3553cbb2db23d543b98ab1401b3dbfa91
1 parent 6287df0 commit 3d32a20

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/hotspot/share/prims/jni.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2234,7 +2234,7 @@ JNI_ENTRY(const char*, jni_GetStringUTFChars(JNIEnv *env, jstring string, jboole
22342234
if (s_value != NULL) {
22352235
size_t length = java_lang_String::utf8_length(java_string, s_value);
22362236
/* JNI Specification states return NULL on OOM */
2237-
result = AllocateHeap(length + 1, mtInternal, 0, AllocFailStrategy::RETURN_NULL);
2237+
result = AllocateHeap(length + 1, mtInternal, AllocFailStrategy::RETURN_NULL);
22382238
if (result != NULL) {
22392239
java_lang_String::as_utf8_string(java_string, s_value, result, (int) length + 1);
22402240
if (isCopy != NULL) {

src/hotspot/share/utilities/nativeCallStack.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -64,7 +64,7 @@ class NativeCallStack : public StackObj {
6464
memset(_stack, 0, sizeof(_stack));
6565
}
6666

67-
NativeCallStack(int toSkip);
67+
explicit NativeCallStack(int toSkip);
6868
NativeCallStack(address* pc, int frameCount);
6969

7070
static inline const NativeCallStack& empty_stack() { return _empty_stack; }

0 commit comments

Comments
 (0)