Bug 1433262
| Summary: | java.util.zip fails opening archives containing >4GB files | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Renaud Métrich <rmetrich> | ||||||||
| Component: | java-1.8.0-openjdk | Assignee: | Andrew John Hughes <ahughes> | ||||||||
| Status: | CLOSED ERRATA | QA Contact: | zzambers | ||||||||
| Severity: | high | Docs Contact: | |||||||||
| Priority: | high | ||||||||||
| Version: | 7.2 | CC: | ahughes, aph, cww, dbhole, jandrlik, jvanek, loskutov, mschena | ||||||||
| Target Milestone: | rc | ||||||||||
| Target Release: | 7.9 | ||||||||||
| Hardware: | Unspecified | ||||||||||
| OS: | Linux | ||||||||||
| Whiteboard: | |||||||||||
| Fixed In Version: | java-1.8.0-openjdk-1.8.0.262.b05-0.4.ea.el7 | Doc Type: | If docs needed, set a value | ||||||||
| Doc Text: | Story Points: | --- | |||||||||
| Clone Of: | |||||||||||
| : | 1660155 1660159 (view as bug list) | Environment: | |||||||||
| Last Closed: | 2020-09-29 19:54:11 UTC | Type: | Bug | ||||||||
| Regression: | --- | Mount Type: | --- | ||||||||
| Documentation: | --- | CRM: | |||||||||
| Verified Versions: | Category: | --- | |||||||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||||||
| Embargoed: | |||||||||||
| Bug Depends On: | |||||||||||
| Bug Blocks: | 1660155 | ||||||||||
| Attachments: |
|
||||||||||
Created attachment 1263974 [details]
Archive created with "zip"
Created attachment 1263975 [details]
Archive created with Windows internal zip tool
Taking this one. Replicated on both OpenJDK 7 & 8: $ /usr/lib/jvm/icedtea-7/bin/java -cp . TestZip 8192m.zip Failed to inspect packed file java.util.zip.ZipException: invalid CEN header (bad signature) at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:221) at java.util.zip.ZipFile.<init>(ZipFile.java:151) at java.util.zip.ZipFile.<init>(ZipFile.java:165) at TestZip.main(TestZip.java:16) $ /usr/lib/jvm/icedtea-8/bin/java -cp . TestZip 8192m.zip Failed to inspect packed file java.util.zip.ZipException: invalid CEN header (bad signature) at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:225) at java.util.zip.ZipFile.<init>(ZipFile.java:155) at java.util.zip.ZipFile.<init>(ZipFile.java:169) at TestZip.main(TestZip.java:16) though, just for amusement value, it does pass on GNU Classpath ;-) $ cacao -cp . TestZip 8192m.zip -> 8192m Succeeded to inspect packed file I'll look into what's going on with the OpenJDK code. (In reply to Andrew John Hughes from comment #10) > Replicated on both OpenJDK 7 & 8: > > $ /usr/lib/jvm/icedtea-7/bin/java -cp . TestZip 8192m.zip > Failed to inspect packed file [ ... ] > > $ cacao -cp . TestZip 8192m.zip > -> 8192m > Succeeded to inspect packed file > > I'll look into what's going on with the OpenJDK code. Did you find the cause Andrew? It passes on OpenJDK 11: $ /usr/lib/openjdk-11/bin/java -cp . TestZip 8192m.zip -> 8192m Succeeded to inspect packed file So we just need to find the right fix to backport. Looks like it might be https://bugs.openjdk.java.net/browse/JDK-8186464 but need to confirm. Hi Andrew, It passes on OpenJDK 11 (tested on RHEL8) only for the ZIP file created using reproducer. However, with the Windows ZIP file in attachment to the BZ, it continues to fail: -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- # /usr/lib/jvm/java-11-openjdk-11.0.1.13-6.el8.x86_64/bin/java -cp . TestZip 8192m.windows.zip Failed to inspect packed file java.util.zip.ZipException: invalid CEN header (bad compression method: 9) at java.base/java.util.zip.ZipFile$Source.zerror(ZipFile.java:1529) at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1497) at java.base/java.util.zip.ZipFile$Source.<init>(ZipFile.java:1268) at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1231) at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:726) at java.base/java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:843) at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:246) at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:176) at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:190) at TestZip.main(TestZip.java:16) -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- See also clone for RHEL8 / openjdk-11: BZ1660159 reproducer added to our internal suite Moving to RHEL 7.8, but we'll aim to get it in 8u232 in October if it is that fix. (In reply to Andrew John Hughes from comment #16) > Moving to RHEL 7.8, but we'll aim to get it in 8u232 in October if it is > that fix. Not sure if you are aware about similar issue related to Zip 64 support broken on Java 11: https://access.redhat.com/support/cases/#/case/02408490 (aka https://bugs.openjdk.java.net/browse/JDK-8226530). Just in case you touch same code, make sure it will not re-introduce other bug from Java 11 on Java 8. Moving to rhel-7.9.0 as rhel-7.8 now requires exception+ or blocker+. We aim to get this upstream first anyway, so it should appear on all supported releases in due course. Drop from 7.8 RPL. JDK-8186464 looks the likely fix for this, as stated above, but as it stands, it depends on a reimplementation of the zip code (https://bugs.openjdk.java.net/browse/JDK-8145260). We're currently looking at the feasibility of backporting this. Will backport JDK-8186464 without JDK-8145260 by porting it to the native implementation. Andrew, the attached test program still fails with both attached examples on 1.8.0_262-b10 build (java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64). How that matches with "fixed in java-1.8.0-openjdk-1.8.0.262.b05-0.4.ea.el7" ? Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (java-1.8.0-openjdk bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2020:3920 (In reply to Andrey Loskutov from comment #28) > Andrew, the attached test program still fails with both attached examples on > 1.8.0_262-b10 build (java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64). > > How that matches with "fixed in java-1.8.0-openjdk-1.8.0.262.b05-0.4.ea.el7" > ? The fix is in RHEL 7.9, not RHEL 7.8. (In reply to Andrew John Hughes from comment #30) > (In reply to Andrey Loskutov from comment #28) > > Andrew, the attached test program still fails with both attached examples on > > 1.8.0_262-b10 build (java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64). > > > > How that matches with "fixed in java-1.8.0-openjdk-1.8.0.262.b05-0.4.ea.el7" > > ? > > The fix is in RHEL 7.9, not RHEL 7.8. Could you please update "fixed in" version? Which exact JDK 8 rpm version contains the fix? The fixed in version is correct. That's the first RHEL 7.9 build the fix went into. I've updated the public target release to make it clear which RHEL version has the fix. Also should be clear from the advisory: https://access.redhat.com/errata/RHBA-2020:3920 |
Created attachment 1263973 [details] Test program opening the Zip with java.util.zip Description of problem: When creating a Zip archive containing >4GB files that get compressed in a <4GB archive, the java.util.zip library fails with the following error: java.util.zip.ZipException: invalid CEN header (bad signature) at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:219) at java.util.zip.ZipFile.<init>(ZipFile.java:149) at java.util.zip.ZipFile.<init>(ZipFile.java:163) Version-Release number of selected component (if applicable): java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3 How reproducible: Always Steps to Reproduce: 0. Compile the provided "TestZip" wrapper javac TestZip 1. Create a 8G file "8192m" filled with zero dd if=/dev/zero of=8192m count=0 bs=1 seek=8192M 2. Zip it so that the archive is smaller than 4GB zip 8192m.zip 8192m 3. Open the file in Java using the provided "TestZip" wrapper java -cp . TestZip 8192m.zip Actual results: ============ 8192m.zip ============ Failed to inspect packed file java.util.zip.ZipException: invalid CEN header (bad signature) at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:219) at java.util.zip.ZipFile.<init>(ZipFile.java:149) at java.util.zip.ZipFile.<init>(ZipFile.java:163) at TestZip.main(TestZip.java:16) Expected results: ============ 8192m.zip ============ -> 8192m Succeeded to inspect packed file Additional info: I made a bunch of tests using different files and found the following: 1. archive of a big file which compresses into a <4GB archive breaks 2. archive of a big file which compresses into a >4GB archive works 3. archive of a big file using 7za and zip format (7za -tzip ...) which compresses into a <4GB archive works 4. archive of a big file using 7za and zip format (7za -tzip ...) which compresses into a >4GB archive works 5. archive of a big file using Windows internal zip tool which compresses into a <4GB archive breaks 6. archive of a big file using WinZip tool which compresses into a <4GB archive works Unzipping the archives created using "unzip", "7za", and other tools always works. Wee see that both "zip" and "windows internal zip tool" (Right clicking on a file and selecting "Send to compress folder") create archives that java.util.zip is not able to read.