Skip to content

Commit

Permalink
8312489: Increase jdk.jar.maxSignatureFileSize default which is too l…
Browse files Browse the repository at this point in the history
…ow for JARs such as WhiteSource/Mend unified agent jar

Backport-of: e47a84f23dd2608c6f5748093eefe301fb5bf750
  • Loading branch information
gnu-andrew committed Sep 5, 2023
1 parent 765f6af commit 50074a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/java.base/share/classes/java/util/jar/JarFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,9 @@ private byte[] getBytes(ZipEntry ze) throws IOException {
throw new IOException("Unsupported size: " + uncompressedSize +
" for JarEntry " + ze.getName() +
". Allowed max size: " +
SignatureFileVerifier.MAX_SIG_FILE_SIZE + " bytes");
SignatureFileVerifier.MAX_SIG_FILE_SIZE + " bytes. " +
"You can use the jdk.jar.maxSignatureFileSize " +
"system property to increase the default value.");
}
int len = (int)uncompressedSize;
int bytesRead;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -852,16 +852,16 @@ private static int initializeMaxSigFileSize() {
* the maximum allowed number of bytes for the signature-related files
* in a JAR file.
*/
Integer tmp = GetIntegerAction.privilegedGetProperty(
"jdk.jar.maxSignatureFileSize", 8000000);
int tmp = GetIntegerAction.privilegedGetProperty(
"jdk.jar.maxSignatureFileSize", 16000000);
if (tmp < 0 || tmp > MAX_ARRAY_SIZE) {
if (debug != null) {
debug.println("Default signature file size 8000000 bytes " +
"is used as the specified size for the " +
"jdk.jar.maxSignatureFileSize system property " +
debug.println("The default signature file size of 16000000 bytes " +
"will be used for the jdk.jar.maxSignatureFileSize " +
"system property since the specified value " +
"is out of range: " + tmp);
}
tmp = 8000000;
tmp = 16000000;
}
return tmp;
}
Expand Down

1 comment on commit 50074a0

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.