8283784: java_lang_String::as_platform_dependent_str stores to oop in native state

Reviewed-by: kbarrett, shade, stefank
This commit is contained in:
David Holmes 2022-03-31 06:53:26 +00:00
parent fbb8ca55a8
commit c9a469a459

View File

@ -454,16 +454,18 @@ char* java_lang_String::as_platform_dependent_str(Handle java_string, TRAPS) {
}
char *native_platform_string;
{ JavaThread* thread = THREAD;
jstring js = (jstring) JNIHandles::make_local(thread, java_string());
bool is_copy;
JavaThread* thread = THREAD;
jstring js = (jstring) JNIHandles::make_local(thread, java_string());
{
HandleMark hm(thread);
ThreadToNativeFromVM ttn(thread);
JNIEnv *env = thread->jni_environment();
bool is_copy;
native_platform_string = (_to_platform_string_fn)(env, js, &is_copy);
assert(is_copy == JNI_TRUE, "is_copy value changed");
JNIHandles::destroy_local(js);
}
JNIHandles::destroy_local(js);
return native_platform_string;
}