Skip to content

Commit e47a84f

Browse files
author
Hai-May Chao
committed
8312489: Increase jdk.jar.maxSignatureFileSize default which is too low for JARs such as WhiteSource/Mend unified agent jar
Reviewed-by: mullan, mbaesken
1 parent 78f6799 commit e47a84f

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
@@ -802,7 +802,9 @@ private byte[] getBytes(ZipEntry ze) throws IOException {
802802
throw new IOException("Unsupported size: " + uncompressedSize +
803803
" for JarEntry " + ze.getName() +
804804
". Allowed max size: " +
805-
SignatureFileVerifier.MAX_SIG_FILE_SIZE + " bytes");
805+
SignatureFileVerifier.MAX_SIG_FILE_SIZE + " bytes. " +
806+
"You can use the jdk.jar.maxSignatureFileSize " +
807+
"system property to increase the default value.");
806808
}
807809
int len = (int)uncompressedSize;
808810
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
@@ -847,16 +847,16 @@ private static int initializeMaxSigFileSize() {
847847
* the maximum allowed number of bytes for the signature-related files
848848
* in a JAR file.
849849
*/
850-
Integer tmp = GetIntegerAction.privilegedGetProperty(
851-
"jdk.jar.maxSignatureFileSize", 8000000);
850+
int tmp = GetIntegerAction.privilegedGetProperty(
851+
"jdk.jar.maxSignatureFileSize", 16000000);
852852
if (tmp < 0 || tmp > MAX_ARRAY_SIZE) {
853853
if (debug != null) {
854-
debug.println("Default signature file size 8000000 bytes " +
855-
"is used as the specified size for the " +
856-
"jdk.jar.maxSignatureFileSize system property " +
854+
debug.println("The default signature file size of 16000000 bytes " +
855+
"will be used for the jdk.jar.maxSignatureFileSize " +
856+
"system property since the specified value " +
857857
"is out of range: " + tmp);
858858
}
859-
tmp = 8000000;
859+
tmp = 16000000;
860860
}
861861
return tmp;
862862
}

0 commit comments

Comments
 (0)