Blame SOURCES/jdk8312489-max_sig_default_increase.patch

22cad3
commit 50074a04e62f91faa080b831d9ce343396ead252
22cad3
Author: Andrew John Hughes <andrew@openjdk.org>
22cad3
Date:   Tue Sep 5 20:48:42 2023 +0000
22cad3
22cad3
    8312489: Increase jdk.jar.maxSignatureFileSize default which is too low for JARs such as WhiteSource/Mend unified agent jar
22cad3
    
22cad3
    Backport-of: e47a84f23dd2608c6f5748093eefe301fb5bf750
22cad3
22cad3
diff --git a/src/java.base/share/classes/java/util/jar/JarFile.java b/src/java.base/share/classes/java/util/jar/JarFile.java
22cad3
index cb7e308e0d..cce897c0d3 100644
22cad3
--- a/src/java.base/share/classes/java/util/jar/JarFile.java
22cad3
+++ b/src/java.base/share/classes/java/util/jar/JarFile.java
22cad3
@@ -809,7 +809,9 @@ class JarFile extends ZipFile {
22cad3
                 throw new IOException("Unsupported size: " + uncompressedSize +
22cad3
                         " for JarEntry " + ze.getName() +
22cad3
                         ". Allowed max size: " +
22cad3
-                        SignatureFileVerifier.MAX_SIG_FILE_SIZE + " bytes");
22cad3
+                        SignatureFileVerifier.MAX_SIG_FILE_SIZE + " bytes. " +
22cad3
+                        "You can use the jdk.jar.maxSignatureFileSize " +
22cad3
+                        "system property to increase the default value.");
22cad3
             }
22cad3
             int len = (int)uncompressedSize;
22cad3
             int bytesRead;
22cad3
diff --git a/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java b/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java
22cad3
index cb477fc134..a766b8249f 100644
22cad3
--- a/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java
22cad3
+++ b/src/java.base/share/classes/sun/security/util/SignatureFileVerifier.java
22cad3
@@ -852,16 +852,16 @@ public class SignatureFileVerifier {
22cad3
          * the maximum allowed number of bytes for the signature-related files
22cad3
          * in a JAR file.
22cad3
          */
22cad3
-        Integer tmp = GetIntegerAction.privilegedGetProperty(
22cad3
-                "jdk.jar.maxSignatureFileSize", 8000000);
22cad3
+        int tmp = GetIntegerAction.privilegedGetProperty(
22cad3
+                "jdk.jar.maxSignatureFileSize", 16000000);
22cad3
         if (tmp < 0 || tmp > MAX_ARRAY_SIZE) {
22cad3
             if (debug != null) {
22cad3
-                debug.println("Default signature file size 8000000 bytes " +
22cad3
-                        "is used as the specified size for the " +
22cad3
-                        "jdk.jar.maxSignatureFileSize system property " +
22cad3
+                debug.println("The default signature file size of 16000000 bytes " +
22cad3
+                        "will be used for the jdk.jar.maxSignatureFileSize " +
22cad3
+                        "system property since the specified value " +
22cad3
                         "is out of range: " + tmp);
22cad3
             }
22cad3
-            tmp = 8000000;
22cad3
+            tmp = 16000000;
22cad3
         }
22cad3
         return tmp;
22cad3
     }