Skip to content

Commit 50074a0

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 765f6af commit 50074a0

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
@@ -809,7 +809,9 @@ private byte[] getBytes(ZipEntry ze) throws IOException {
809809
throw new IOException("Unsupported size: " + uncompressedSize +
810810
" for JarEntry " + ze.getName() +
811811
". Allowed max size: " +
812-
SignatureFileVerifier.MAX_SIG_FILE_SIZE + " bytes");
812+
SignatureFileVerifier.MAX_SIG_FILE_SIZE + " bytes. " +
813+
"You can use the jdk.jar.maxSignatureFileSize " +
814+
"system property to increase the default value.");
813815
}
814816
int len = (int)uncompressedSize;
815817
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
@@ -852,16 +852,16 @@ private static int initializeMaxSigFileSize() {
852852
* the maximum allowed number of bytes for the signature-related files
853853
* in a JAR file.
854854
*/
855-
Integer tmp = GetIntegerAction.privilegedGetProperty(
856-
"jdk.jar.maxSignatureFileSize", 8000000);
855+
int tmp = GetIntegerAction.privilegedGetProperty(
856+
"jdk.jar.maxSignatureFileSize", 16000000);
857857
if (tmp < 0 || tmp > MAX_ARRAY_SIZE) {
858858
if (debug != null) {
859-
debug.println("Default signature file size 8000000 bytes " +
860-
"is used as the specified size for the " +
861-
"jdk.jar.maxSignatureFileSize system property " +
859+
debug.println("The default signature file size of 16000000 bytes " +
860+
"will be used for the jdk.jar.maxSignatureFileSize " +
861+
"system property since the specified value " +
862862
"is out of range: " + tmp);
863863
}
864-
tmp = 8000000;
864+
tmp = 16000000;
865865
}
866866
return tmp;
867867
}

0 commit comments

Comments
 (0)