RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1433262 - java.util.zip fails opening archives containing >4GB files
Summary: java.util.zip fails opening archives containing >4GB files
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: java-1.8.0-openjdk
Version: 7.2
Hardware: Unspecified
OS: Linux
high
high
Target Milestone: rc
: 7.9
Assignee: Andrew John Hughes
QA Contact: zzambers
URL:
Whiteboard:
Depends On:
Blocks: 1660155
TreeView+ depends on / blocked
 
Reported: 2017-03-17 08:54 UTC by Renaud Métrich
Modified: 2024-10-01 16:04 UTC (History)
8 users (show)

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:
Clone Of:
: 1660155 1660159 (view as bug list)
Environment:
Last Closed: 2020-09-29 19:54:11 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Test program opening the Zip with java.util.zip (770 bytes, text/plain)
2017-03-17 08:54 UTC, Renaud Métrich
no flags Details
Archive created with "zip" (7.95 MB, application/zip)
2017-03-17 08:56 UTC, Renaud Métrich
no flags Details
Archive created with Windows internal zip tool (288.26 KB, application/zip)
2017-03-17 08:57 UTC, Renaud Métrich
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:3920 0 None None None 2020-09-29 19:54:51 UTC
openjdk bug system JDK-8186464 0 None None None 2020-05-21 18:15:08 UTC

Description Renaud Métrich 2017-03-17 08:54:20 UTC
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.

Comment 2 Renaud Métrich 2017-03-17 08:56:15 UTC
Created attachment 1263974 [details]
Archive created with "zip"

Comment 3 Renaud Métrich 2017-03-17 08:57:02 UTC
Created attachment 1263975 [details]
Archive created with Windows internal zip tool

Comment 4 Andrew John Hughes 2017-06-28 02:33:37 UTC
Taking this one.

Comment 10 Andrew John Hughes 2018-06-11 22:52:43 UTC
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.

Comment 11 Deepak Bhole 2018-11-22 20:24:05 UTC
(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?

Comment 12 Andrew John Hughes 2018-12-12 04:14:11 UTC
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.

Comment 13 Andrew John Hughes 2018-12-12 04:34:26 UTC
Looks like it might be https://bugs.openjdk.java.net/browse/JDK-8186464 but need to confirm.

Comment 14 Renaud Métrich 2018-12-17 16:22:41 UTC
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

Comment 15 jiri vanek 2019-01-03 14:25:01 UTC
reproducer added to our internal suite

Comment 16 Andrew John Hughes 2019-06-28 17:02:59 UTC
Moving to RHEL 7.8, but we'll aim to get it in 8u232 in October if it is that fix.

Comment 17 Andrey Loskutov 2019-07-22 12:30:30 UTC
(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.

Comment 18 Andrew John Hughes 2019-11-20 06:16:42 UTC
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.

Comment 19 Andrew John Hughes 2019-11-20 06:30:08 UTC
Drop from 7.8 RPL.

Comment 21 Andrew John Hughes 2020-05-21 18:15:08 UTC
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.

Comment 22 Andrew John Hughes 2020-06-05 01:12:21 UTC
Will backport JDK-8186464 without JDK-8145260 by porting it to the native implementation.

Comment 28 Andrey Loskutov 2020-09-29 07:29:38 UTC
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" ?

Comment 29 errata-xmlrpc 2020-09-29 19:54:11 UTC
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

Comment 30 Andrew John Hughes 2021-06-07 17:11:46 UTC
(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.

Comment 31 Andrey Loskutov 2021-06-07 17:54:43 UTC
(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?

Comment 32 Andrew John Hughes 2021-06-08 04:41:44 UTC
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.

Comment 33 Andrew John Hughes 2021-06-08 04:55:35 UTC
Also should be clear from the advisory: https://access.redhat.com/errata/RHBA-2020:3920


Note You need to log in before you can comment on or make changes to this bug.