changeset 13271:4a23ff05b4f9 jdk8u192-b06

Merge
author aefimov
date Tue, 14 Aug 2018 08:44:11 +0100
parents eb13b1bc1ef2 ca864c999536
children 2547dff41536
files
diffstat 5 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/jar/JarFile.java	Fri Aug 10 12:20:05 2018 +0100
+++ b/src/share/classes/java/util/jar/JarFile.java	Tue Aug 14 08:44:11 2018 +0100
@@ -602,7 +602,7 @@
         return false;
     }
 
-    private synchronized void ensureInitialization() {
+    synchronized void ensureInitialization() {
         try {
             maybeInstantiateVerifier();
         } catch (IOException e) {
--- a/src/share/classes/java/util/jar/JavaUtilJarAccessImpl.java	Fri Aug 10 12:20:05 2018 +0100
+++ b/src/share/classes/java/util/jar/JavaUtilJarAccessImpl.java	Tue Aug 14 08:44:11 2018 +0100
@@ -65,4 +65,7 @@
         return man.getTrustedAttributes(name);
     }
 
+    public void ensureInitialization(JarFile jar) {
+        jar.ensureInitialization();
+    }
 }
--- a/src/share/classes/java/util/jar/Manifest.java	Fri Aug 10 12:20:05 2018 +0100
+++ b/src/share/classes/java/util/jar/Manifest.java	Tue Aug 14 08:44:11 2018 +0100
@@ -150,6 +150,10 @@
      *      does not exist in SF files of all signers).
      */
     Attributes getTrustedAttributes(String name) {
+        // Note: Before the verification of MANIFEST.MF/.SF/.RSA files is done,
+        // jv.isTrustedManifestEntry() isn't able to detect MANIFEST.MF change.
+        // Users of this method should call SharedSecrets.javaUtilJarAccess()
+        // .ensureInitialization() first.
         Attributes result = getAttributes(name);
         if (result != null && jv != null && ! jv.isTrustedManifestEntry(name)) {
             throw new SecurityException("Untrusted manifest entry: " + name);
--- a/src/share/classes/sun/misc/JavaUtilJarAccess.java	Fri Aug 10 12:20:05 2018 +0100
+++ b/src/share/classes/sun/misc/JavaUtilJarAccess.java	Tue Aug 14 08:44:11 2018 +0100
@@ -44,4 +44,5 @@
     public void setEagerValidation(JarFile jar, boolean eager);
     public List<Object> getManifestDigests(JarFile jar);
     public Attributes getTrustedAttributes(Manifest man, String name);
+    public void ensureInitialization(JarFile jar);
 }
--- a/src/share/classes/sun/misc/URLClassPath.java	Fri Aug 10 12:20:05 2018 +0100
+++ b/src/share/classes/sun/misc/URLClassPath.java	Tue Aug 14 08:44:11 2018 +0100
@@ -987,8 +987,10 @@
                     { return jar.getInputStream(entry); }
                 public int getContentLength()
                     { return (int)entry.getSize(); }
-                public Manifest getManifest() throws IOException
-                    { return jar.getManifest(); };
+                public Manifest getManifest() throws IOException {
+                    SharedSecrets.javaUtilJarAccess().ensureInitialization(jar);
+                    return jar.getManifest();
+                }
                 public Certificate[] getCertificates()
                     { return entry.getCertificates(); };
                 public CodeSigner[] getCodeSigners()