From 712d8ff48ecb2363ee72ac712e89fcdaf701c9d9 Mon Sep 17 00:00:00 2001 From: Jaroslav Bachorik Date: Fri, 18 Jul 2014 17:23:28 +0200 Subject: [PATCH] 8035829: [parfait] JNI exception pending in jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c Reviewed-by: sundar, kevinw --- .../windows/native/sun/tools/attach/WindowsVirtualMachine.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c b/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c index 94fb2f72ceb..411d1777a54 100644 --- a/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c +++ b/jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c @@ -388,6 +388,7 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_WindowsVirtualMachine_enqueue if (argsLen > 0) { if (argsLen > MAX_ARGS) { JNU_ThrowInternalError(env, "Too many arguments"); + return; } for (i=0; iGetObjectArrayElement(env, args, i); @@ -423,6 +424,8 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_WindowsVirtualMachine_enqueue stubLen = (DWORD)(*env)->GetArrayLength(env, stub); stubCode = (*env)->GetByteArrayElements(env, stub, &isCopy); + if ((*env)->ExceptionOccurred(env)) return; + pCode = (PDWORD) VirtualAllocEx( hProcess, 0, stubLen, MEM_COMMIT, PAGE_EXECUTE_READWRITE ); if (pCode == NULL) { JNU_ThrowIOExceptionWithLastError(env, "VirtualAllocEx failed"); @@ -592,6 +595,8 @@ static void jstring_to_cstring(JNIEnv* env, jstring jstr, char* cstr, int len) { cstr[0] = '\0'; } else { str = JNU_GetStringPlatformChars(env, jstr, &isCopy); + if ((*env)->ExceptionOccurred(env)) return; + strncpy(cstr, str, len); cstr[len-1] = '\0'; if (isCopy) {