8363928: Specifying AOTCacheOutput with a blank path causes the JVM to crash

Reviewed-by: kvn, iklam
This commit is contained in:
Calvin Cheung 2025-07-29 17:41:30 +00:00
parent c239c0ab00
commit ea754316fd
4 changed files with 11 additions and 0 deletions

View File

@ -121,6 +121,7 @@
\
product(ccstr, AOTCacheOutput, nullptr, \
"Specifies the file name for writing the AOT cache") \
constraint(AOTCacheOutputConstraintFunc, AtParse) \
\
product(bool, AOTInvokeDynamicLinking, false, DIAGNOSTIC, \
"AOT-link JVM_CONSTANT_InvokeDynamic entries in cached " \

View File

@ -39,6 +39,14 @@ JVMFlag::Error AOTCacheConstraintFunc(ccstr value, bool verbose) {
return JVMFlag::SUCCESS;
}
JVMFlag::Error AOTCacheOutputConstraintFunc(ccstr value, bool verbose) {
if (value == nullptr) {
JVMFlag::printError(verbose, "AOTCacheOutput cannot be empty\n");
return JVMFlag::VIOLATES_CONSTRAINT;
}
return JVMFlag::SUCCESS;
}
JVMFlag::Error AOTConfigurationConstraintFunc(ccstr value, bool verbose) {
if (value == nullptr) {
JVMFlag::printError(verbose, "AOTConfiguration cannot be empty\n");

View File

@ -35,6 +35,7 @@
#define RUNTIME_CONSTRAINTS(f) \
f(ccstr, AOTCacheConstraintFunc) \
f(ccstr, AOTCacheOutputConstraintFunc) \
f(ccstr, AOTConfigurationConstraintFunc) \
f(ccstr, AOTModeConstraintFunc) \
f(int, ObjectAlignmentInBytesConstraintFunc) \

View File

@ -484,6 +484,7 @@ public class AOTFlags {
testEmptyValue("AOTCache");
testEmptyValue("AOTConfiguration");
testEmptyValue("AOTMode");
testEmptyValue("AOTCacheOutput");
}
static void testEmptyValue(String option) throws Exception {