Skip to content

Commit 5b613e3

Browse files
committed
8312489: Increase jdk.jar.maxSignatureFileSize default which is too low for JARs such as WhiteSource/Mend unified agent jar
Backport-of: e47a84f23dd2608c6f5748093eefe301fb5bf750
1 parent f85df30 commit 5b613e3

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/java.base/share/classes/java/util/jar/JarFile.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,9 @@ private byte[] getBytes(ZipEntry ze) throws IOException {
803803
throw new IOException("Unsupported size: " + uncompressedSize +
804804
" for JarEntry " + ze.getName() +
805805
". Allowed max size: " +
806-
SignatureFileVerifier.MAX_SIG_FILE_SIZE + " bytes");
806+
SignatureFileVerifier.MAX_SIG_FILE_SIZE + " bytes. " +
807+
"You can use the jdk.jar.maxSignatureFileSize " +
808+
"system property to increase the default value.");
807809
}
808810
int len = (int)uncompressedSize;
809811
int bytesRead;

src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -856,16 +856,16 @@ private static int initializeMaxSigFileSize() {
856856
* the maximum allowed number of bytes for the signature-related files
857857
* in a JAR file.
858858
*/
859-
Integer tmp = GetIntegerAction.privilegedGetProperty(
860-
"jdk.jar.maxSignatureFileSize", 8000000);
859+
int tmp = GetIntegerAction.privilegedGetProperty(
860+
"jdk.jar.maxSignatureFileSize", 16000000);
861861
if (tmp < 0 || tmp > MAX_ARRAY_SIZE) {
862862
if (debug != null) {
863-
debug.println("Default signature file size 8000000 bytes " +
864-
"is used as the specified size for the " +
865-
"jdk.jar.maxSignatureFileSize system property " +
863+
debug.println("The default signature file size of 16000000 bytes " +
864+
"will be used for the jdk.jar.maxSignatureFileSize " +
865+
"system property since the specified value " +
866866
"is out of range: " + tmp);
867867
}
868-
tmp = 8000000;
868+
tmp = 16000000;
869869
}
870870
return tmp;
871871
}

0 commit comments

Comments
 (0)