提交 86de24e1 编写于 作者: I igerasim

8208754: The fix for JDK-8194534 needs updates

Reviewed-by: alanb, igerasim, rhalade, mullan
上级 b66797e1
...@@ -602,7 +602,7 @@ class JarFile extends ZipFile { ...@@ -602,7 +602,7 @@ class JarFile extends ZipFile {
return false; return false;
} }
private synchronized void ensureInitialization() { synchronized void ensureInitialization() {
try { try {
maybeInstantiateVerifier(); maybeInstantiateVerifier();
} catch (IOException e) { } catch (IOException e) {
......
...@@ -65,4 +65,7 @@ class JavaUtilJarAccessImpl implements JavaUtilJarAccess { ...@@ -65,4 +65,7 @@ class JavaUtilJarAccessImpl implements JavaUtilJarAccess {
return man.getTrustedAttributes(name); return man.getTrustedAttributes(name);
} }
public void ensureInitialization(JarFile jar) {
jar.ensureInitialization();
}
} }
...@@ -150,6 +150,10 @@ public class Manifest implements Cloneable { ...@@ -150,6 +150,10 @@ public class Manifest implements Cloneable {
* does not exist in SF files of all signers). * does not exist in SF files of all signers).
*/ */
Attributes getTrustedAttributes(String name) { 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); Attributes result = getAttributes(name);
if (result != null && jv != null && ! jv.isTrustedManifestEntry(name)) { if (result != null && jv != null && ! jv.isTrustedManifestEntry(name)) {
throw new SecurityException("Untrusted manifest entry: " + name); throw new SecurityException("Untrusted manifest entry: " + name);
......
...@@ -44,4 +44,5 @@ public interface JavaUtilJarAccess { ...@@ -44,4 +44,5 @@ public interface JavaUtilJarAccess {
public void setEagerValidation(JarFile jar, boolean eager); public void setEagerValidation(JarFile jar, boolean eager);
public List<Object> getManifestDigests(JarFile jar); public List<Object> getManifestDigests(JarFile jar);
public Attributes getTrustedAttributes(Manifest man, String name); public Attributes getTrustedAttributes(Manifest man, String name);
public void ensureInitialization(JarFile jar);
} }
...@@ -987,8 +987,10 @@ public class URLClassPath { ...@@ -987,8 +987,10 @@ public class URLClassPath {
{ return jar.getInputStream(entry); } { return jar.getInputStream(entry); }
public int getContentLength() public int getContentLength()
{ return (int)entry.getSize(); } { return (int)entry.getSize(); }
public Manifest getManifest() throws IOException public Manifest getManifest() throws IOException {
{ return jar.getManifest(); }; SharedSecrets.javaUtilJarAccess().ensureInitialization(jar);
return jar.getManifest();
}
public Certificate[] getCertificates() public Certificate[] getCertificates()
{ return entry.getCertificates(); }; { return entry.getCertificates(); };
public CodeSigner[] getCodeSigners() public CodeSigner[] getCodeSigners()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册