mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8208754: The fix for JDK-8194534 needs updates
Reviewed-by: alanb, igerasim, rhalade, mullan
This commit is contained in:
parent
1c4396ebae
commit
61d19ee892
5 changed files with 13 additions and 3 deletions
|
@ -1025,7 +1025,7 @@ class JarFile extends ZipFile {
|
|||
}
|
||||
}
|
||||
|
||||
private synchronized void ensureInitialization() {
|
||||
synchronized void ensureInitialization() {
|
||||
try {
|
||||
maybeInstantiateVerifier();
|
||||
} catch (IOException e) {
|
||||
|
|
|
@ -65,4 +65,7 @@ class JavaUtilJarAccessImpl implements JavaUtilJarAccess {
|
|||
return man.getTrustedAttributes(name);
|
||||
}
|
||||
|
||||
public void ensureInitialization(JarFile jar) {
|
||||
jar.ensureInitialization();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -169,6 +169,10 @@ public class Manifest implements Cloneable {
|
|||
* 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);
|
||||
|
|
|
@ -866,8 +866,10 @@ public class URLClassPath {
|
|||
{ 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()
|
||||
|
|
|
@ -44,4 +44,5 @@ public interface JavaUtilJarAccess {
|
|||
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue