Skip to content

Commit 29ebe6e

Browse files
committed
[GR-52169] Parfait findings in Windows native code.
PullRequest: graal/17236
2 parents 5a2d13a + 9ce3e8d commit 29ebe6e

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

substratevm/src/com.oracle.svm.native.jvm.windows/src/JvmFuncs.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,15 @@ JNIEXPORT jobject JNICALL JVM_DoPrivileged(JNIEnv *env, jclass cls, jobject acti
233233
return (*env)->CallObjectMethod(env, action, run);
234234
}
235235
}
236+
237+
/* Some error occurred - clear pending exception and try to report the error. */
238+
(*env)->ExceptionClear(env);
239+
236240
errorClass = (*env)->FindClass(env, "java/lang/InternalError");
237241
if (errorClass != NULL && !(*env)->ExceptionCheck(env)) {
238242
(*env)->ThrowNew(env, errorClass, "Could not invoke PrivilegedAction");
239243
} else {
244+
(*env)->ExceptionClear(env);
240245
(*env)->FatalError(env, "PrivilegedAction could not be invoked and the error could not be reported");
241246
}
242247
return NULL;

substratevm/src/com.oracle.svm.native.libchelper/src/getEnviron.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ char **getEnviron() {
3333
#else
3434

3535
#include <windows.h>
36+
#include <stdio.h>
3637

3738
static char **envptr = NULL;
3839
static char *env = NULL;

substratevm/src/com.oracle.svm.native.libchelper/src/timeZone.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
#include <stdio.h>
3535
#include <stdlib.h>
3636

37+
#define jio_fprintf fprintf
38+
3739
#define VALUE_UNKNOWN 0
3840
#define VALUE_KEY 1
3941
#define VALUE_MAPID 2
@@ -107,7 +109,7 @@ getValueInRegistry(HKEY hKey,
107109

108110
valSize = sizeof(val);
109111
ret = RegQueryValueExA(hKey, (char *) keyNames[keyIndex + 1], NULL,
110-
typePtr, val, &valSize);
112+
typePtr, (LPBYTE) val, &valSize);
111113
if (ret != ERROR_SUCCESS) {
112114
return ret;
113115
}
@@ -323,7 +325,7 @@ static int getWinTimeZone(char *winZoneName)
323325

324326
size = sizeof(szValue);
325327
ret = getValueInRegistry(hSubKey, STD_NAME, &valueType,
326-
szValue, &size);
328+
(LPBYTE) szValue, &size);
327329
if (ret != ERROR_SUCCESS) {
328330
/*
329331
* NT 4.0 SP3 fails here since it doesn't have the "Std"

0 commit comments

Comments
 (0)