Skip to content

Commit f9d3489

Browse files
committed
8363928: Specifying AOTCacheOutput with a blank path causes the JVM to crash
Backport-of: ea754316fd6d691a701dfb4bc921ea8c92dc5dd4
1 parent 037133e commit f9d3489

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

src/hotspot/share/cds/cds_globals.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
\
122122
product(ccstr, AOTCacheOutput, nullptr, \
123123
"Specifies the file name for writing the AOT cache") \
124+
constraint(AOTCacheOutputConstraintFunc, AtParse) \
124125
\
125126
product(bool, AOTInvokeDynamicLinking, false, DIAGNOSTIC, \
126127
"AOT-link JVM_CONSTANT_InvokeDynamic entries in cached " \

src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ JVMFlag::Error AOTCacheConstraintFunc(ccstr value, bool verbose) {
3939
return JVMFlag::SUCCESS;
4040
}
4141

42+
JVMFlag::Error AOTCacheOutputConstraintFunc(ccstr value, bool verbose) {
43+
if (value == nullptr) {
44+
JVMFlag::printError(verbose, "AOTCacheOutput cannot be empty\n");
45+
return JVMFlag::VIOLATES_CONSTRAINT;
46+
}
47+
return JVMFlag::SUCCESS;
48+
}
49+
4250
JVMFlag::Error AOTConfigurationConstraintFunc(ccstr value, bool verbose) {
4351
if (value == nullptr) {
4452
JVMFlag::printError(verbose, "AOTConfiguration cannot be empty\n");

src/hotspot/share/runtime/flags/jvmFlagConstraintsRuntime.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
#define RUNTIME_CONSTRAINTS(f) \
3737
f(ccstr, AOTCacheConstraintFunc) \
38+
f(ccstr, AOTCacheOutputConstraintFunc) \
3839
f(ccstr, AOTConfigurationConstraintFunc) \
3940
f(ccstr, AOTModeConstraintFunc) \
4041
f(int, ObjectAlignmentInBytesConstraintFunc) \

test/hotspot/jtreg/runtime/cds/appcds/aotFlags/AOTFlags.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ static void negativeTests() throws Exception {
484484
testEmptyValue("AOTCache");
485485
testEmptyValue("AOTConfiguration");
486486
testEmptyValue("AOTMode");
487+
testEmptyValue("AOTCacheOutput");
487488
}
488489

489490
static void testEmptyValue(String option) throws Exception {

0 commit comments

Comments
 (0)