8234076: JVM crashes on Windows 10 using --module=NAME

Reviewed-by: ksrini, henryjen
This commit is contained in:
Nikola Grcevski 2019-12-12 08:40:19 +00:00 committed by Henry Jen
parent fa92bd31b9
commit ce7ede95eb
6 changed files with 207 additions and 0 deletions

View file

@ -130,6 +130,8 @@ static void checkArg(const char *arg) {
}
} else if (JLI_StrCmp(arg, "--disable-@files") == 0) {
stopExpansion = JNI_TRUE;
} else if (JLI_StrCCmp(arg, "--module=") == 0) {
idx = argsCount;
}
} else {
if (!expectingNoDashArg) {
@ -449,6 +451,7 @@ int isTerminalOpt(char *arg) {
return JLI_StrCmp(arg, "-jar") == 0 ||
JLI_StrCmp(arg, "-m") == 0 ||
JLI_StrCmp(arg, "--module") == 0 ||
JLI_StrCCmp(arg, "--module=") == 0 ||
JLI_StrCmp(arg, "--dry-run") == 0 ||
JLI_StrCmp(arg, "-h") == 0 ||
JLI_StrCmp(arg, "-?") == 0 ||

View file

@ -34,6 +34,7 @@
#include <sys/stat.h>
#include <wtypes.h>
#include <commctrl.h>
#include <assert.h>
#include <jni.h>
#include "java.h"
@ -1008,6 +1009,17 @@ CreateApplicationArgs(JNIEnv *env, char **strv, int argc)
// sanity check, match the args we have, to the holy grail
idx = JLI_GetAppArgIndex();
// First arg index is NOT_FOUND
if (idx < 0) {
// The only allowed value should be NOT_FOUND (-1) unless another change introduces
// a different negative index
assert (idx == -1);
JLI_TraceLauncher("Warning: first app arg index not found, %d\n", idx);
JLI_TraceLauncher("passing arguments as-is.\n");
return NewPlatformStringArray(env, strv, argc);
}
isTool = (idx == 0);
if (isTool) { idx++; } // skip tool name
JLI_TraceLauncher("AppArgIndex: %d points to %s\n", idx, stdargs[idx].arg);