Skip to content
Permalink
Browse files

8248524: [JVMCI] Memory corruption / segfault during NumPy installation

Reviewed-by: kvn
  • Loading branch information
Tom Rodriguez
Tom Rodriguez committed Jul 15, 2020
1 parent e07ad83 commit 8cfc7e39dffca26a076ceecb177566ad01b3977f
Showing with 2 additions and 16 deletions.
  1. +2 −15 src/hotspot/share/jvmci/jvmciEnv.cpp
  2. +0 −1 src/hotspot/share/jvmci/jvmciEnv.hpp
@@ -621,26 +621,13 @@ const char* JVMCIEnv::as_utf8_string(JVMCIObject str) {
} else {
JNIAccessMark jni(this);
int length = jni()->GetStringLength(str.as_jstring());
char* result = NEW_RESOURCE_ARRAY(char, length + 1);
int utf8_length = jni()->GetStringUTFLength(str.as_jstring());
char* result = NEW_RESOURCE_ARRAY(char, utf8_length + 1);
jni()->GetStringUTFRegion(str.as_jstring(), 0, length, result);
return result;
}
}

char* JVMCIEnv::as_utf8_string(JVMCIObject str, char* buf, int buflen) {
if (is_hotspot()) {
return java_lang_String::as_utf8_string(HotSpotJVMCI::resolve(str), buf, buflen);
} else {
JNIAccessMark jni(this);
int length = jni()->GetStringLength(str.as_jstring());
if (length >= buflen) {
length = buflen;
}
jni()->GetStringUTFRegion(str.as_jstring(), 0, length, buf);
return buf;
}
}

#define DO_THROW(name) \
void JVMCIEnv::throw_##name(const char* msg) { \
if (is_hotspot()) { \
@@ -261,7 +261,6 @@ class JVMCIEnv : public ResourceObj {
JVMCIObject create_box(BasicType type, jvalue* value, JVMCI_TRAPS);

const char* as_utf8_string(JVMCIObject str);
char* as_utf8_string(JVMCIObject str, char* buf, int buflen);

JVMCIObject create_string(Symbol* str, JVMCI_TRAPS) {
JVMCIObject s = create_string(str->as_C_string(), JVMCI_CHECK_(JVMCIObject()));

0 comments on commit 8cfc7e3

Please sign in to comment.