Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception adding Streams at result file size > 4.2 GB #190

Closed
mmagicgit opened this issue May 25, 2020 · 6 comments
Closed

Exception adding Streams at result file size > 4.2 GB #190

mmagicgit opened this issue May 25, 2020 · 6 comments
Assignees
Labels
bug Something isn't working resolved

Comments

@mmagicgit
Copy link

mmagicgit commented May 25, 2020

Hi, I'm getting a exception if I add multiple streams to a zip file. The pseudo code and exception is below. Let the code run until the resulting zip file reaches 4.2 GB. I think that code should work, what do you think?

Thx in advance!

Code:
Path zipFile = /* zip File /;
byte[] bytes = Files.readAllBytes(/
path to 10 Mb file*/);
for (int i = 0; i < 500; i++) {
ZipParameters parameters = new ZipParameters();
parameters.setFileNameInZip(i + "");
new ZipFile(zipFile.toFile()).addStream(new ByteArrayInputStream(bytes), parameters);
}

Exception:
net.lingala.zip4j.exception.ZipException: invalid signature for zip64 end of central directory record
at net.lingala.zip4j.headers.HeaderReader.readZip64EndCentralDirRec(HeaderReader.java:389)
at net.lingala.zip4j.headers.HeaderReader.readAllHeaders(HeaderReader.java:91)
at net.lingala.zip4j.ZipFile.readZipInfo(ZipFile.java:973)
at net.lingala.zip4j.ZipFile.addStream(ZipFile.java:403)

I'm using version 2.6 but earlier versions were also affected in a different way. Version 2.3 doesnt throw an exception but produces a corrupted zip file.

@srikanth-lingala
Copy link
Owner

Code seems to be fine. It should have worked. I will try it out and update the thread.

@srikanth-lingala
Copy link
Owner

I was able to reproduce this. Working on a fix.

@srikanth-lingala srikanth-lingala added the bug Something isn't working label May 26, 2020
srikanth-lingala added a commit that referenced this issue May 26, 2020
srikanth-lingala added a commit that referenced this issue May 27, 2020
@srikanth-lingala
Copy link
Owner

Issue fixed. Will include the fix in the next release.

@mmagicgit
Copy link
Author

Thank you for the fast response and fix. I tested this and can confirm the issue is solved in 2.6.1-SNAPSHOT. Good Work!
Are there any plans for the next release? Can you say when that will be approximately?

@srikanth-lingala
Copy link
Owner

There are a couple of more bugs reported that need to be fixed and I will make a release. Most likely this week/weekend.

@srikanth-lingala
Copy link
Owner

Fix included in v2.6.1 released today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working resolved
Projects
None yet
Development

No branches or pull requests

2 participants