Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
8253299: Manifest bytes are read twice when verifying a signed JAR
Browse files Browse the repository at this point in the history
Reviewed-by: redestad, lancea, alanb
  • Loading branch information
Hai-May Chao authored and Lance Andersen committed Nov 19, 2020
1 parent 580f22c commit 9bb8223
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/java.base/share/classes/java/util/jar/JarFile.java
Expand Up @@ -739,14 +739,19 @@ private void initializeVerifier() {
List<String> names = JUZFA.getManifestAndSignatureRelatedFiles(this);
for (String name : names) {
JarEntry e = getJarEntry(name);
byte[] b;
if (e == null) {
throw new JarException("corrupted jar file");
}
if (mev == null) {
mev = new ManifestEntryVerifier
(getManifestFromReference());
}
byte[] b = getBytes(e);
if (name.equals(MANIFEST_NAME)) {
b = jv.manifestRawBytes;
} else {
b = getBytes(e);
}
if (b != null && b.length > 0) {
jv.beginEntry(e, mev);
jv.update(b.length, b, 0, b.length, mev);
Expand Down

0 comments on commit 9bb8223

Please sign in to comment.