Name: js151677 Date: 07/28/2004
FULL PRODUCT VERSION :
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux baltic 2.6.7-1-686-smp #1 SMP Thu Jul 8 06:08:37 EDT 2004 i686 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
JarDiff reuses ZipEntry objects without properly clearing out their compressed size:
[From JarDiff.java]:
while (entries.hasNext()) {
String newName = (String)entries.next();
if (_debug) {
System.out.println("New File: " + newName);
}
writeEntry(jos, newJar.getEntryByName(newName), newJar);
}
later in writeEntry() we see it directly added to the new jar file:
private static void writeEntry(JarOutputStream jos, JarEntry entry,
InputStream data) throws IOException {
jos.putNextEntry(entry);
If the data compresses to a different size in the new jar file, the ZipOutputStream will fail with an exception: invalid entry compressed size.
The compressed size should be cleared out before reusing the ZipEntry.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Attempt to create a jardiff of jar files created with a non-standard compression level.
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Before creating a jardiff the two source jar files can be recreated completely with the same JVM version that will be used to perform the jardiff.
(Incident Review ID: 290083)
======================================================================
FULL PRODUCT VERSION :
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux baltic 2.6.7-1-686-smp #1 SMP Thu Jul 8 06:08:37 EDT 2004 i686 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
JarDiff reuses ZipEntry objects without properly clearing out their compressed size:
[From JarDiff.java]:
while (entries.hasNext()) {
String newName = (String)entries.next();
if (_debug) {
System.out.println("New File: " + newName);
}
writeEntry(jos, newJar.getEntryByName(newName), newJar);
}
later in writeEntry() we see it directly added to the new jar file:
private static void writeEntry(JarOutputStream jos, JarEntry entry,
InputStream data) throws IOException {
jos.putNextEntry(entry);
If the data compresses to a different size in the new jar file, the ZipOutputStream will fail with an exception: invalid entry compressed size.
The compressed size should be cleared out before reusing the ZipEntry.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Attempt to create a jardiff of jar files created with a non-standard compression level.
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Before creating a jardiff the two source jar files can be recreated completely with the same JVM version that will be used to perform the jardiff.
(Incident Review ID: 290083)
======================================================================
- relates to
-
JDK-8253952 Refine ZipOutputStream.putNextEntry() to recalculate ZipEntry's compressed size
-
- Resolved
-