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

net.lingala.zip4j.exception.ZipException: invalid code lengths set #228

Closed
187nitro opened this issue Aug 18, 2020 · 12 comments
Closed

net.lingala.zip4j.exception.ZipException: invalid code lengths set #228

187nitro opened this issue Aug 18, 2020 · 12 comments

Comments

@187nitro
Copy link

Hi,

I cannot unzip files with following information (prodived by 7zip):

Method: pkAES-256 Deflate
Chraracteristics: 0xD StrongCrypto : Encrypt StrongCrypto

I will get the following stacktrace:

net.lingala.zip4j.exception.ZipException: java.io.IOException: java.util.zip.DataFormatException: invalid code lengths set at net.lingala.zip4j.tasks.AsyncZipTask.performTaskWithErrorHandling(AsyncZipTask.java:51) at net.lingala.zip4j.tasks.AsyncZipTask.execute(AsyncZipTask.java:38) at net.lingala.zip4j.ZipFile.extractFile(ZipFile.java:494) at net.lingala.zip4j.ZipFile.extractFile(ZipFile.java:460) at Main.main(Main.java:29) Caused by: java.io.IOException: java.util.zip.DataFormatException: invalid code lengths set at net.lingala.zip4j.io.inputstream.InflaterInputStream.read(InflaterInputStream.java:55) at net.lingala.zip4j.io.inputstream.ZipInputStream.read(ZipInputStream.java:141) at net.lingala.zip4j.io.inputstream.ZipInputStream.read(ZipInputStream.java:121) at net.lingala.zip4j.tasks.AbstractExtractFileTask.unzipFile(AbstractExtractFileTask.java:82) at net.lingala.zip4j.tasks.AbstractExtractFileTask.extractFile(AbstractExtractFileTask.java:64) at net.lingala.zip4j.tasks.ExtractFileTask.executeTask(ExtractFileTask.java:39) at net.lingala.zip4j.tasks.ExtractFileTask.executeTask(ExtractFileTask.java:21) at net.lingala.zip4j.tasks.AsyncZipTask.performTaskWithErrorHandling(AsyncZipTask.java:44) ... 4 more Caused by: java.util.zip.DataFormatException: invalid code lengths set at java.util.zip.Inflater.inflateBytes(Native Method) at java.util.zip.Inflater.inflate(Inflater.java:259) at net.lingala.zip4j.io.inputstream.InflaterInputStream.read(InflaterInputStream.java:45)

Thank you!

@187nitro 187nitro changed the title et.lingala.zip4j.exception.ZipException: invalid code lengths set net.lingala.zip4j.exception.ZipException: invalid code lengths set Aug 18, 2020
@srikanth-lingala
Copy link
Owner

Which version of zip4j are you using? Would it be possible to attach the zip file?

@187nitro
Copy link
Author

Hi,

I am using 2.6.1.

test.zip

How can I send the password to you in private?

Thank you!

@srikanth-lingala
Copy link
Owner

You can send me via email. My email is in the last section of ReadMe.

@187nitro
Copy link
Author

You can send me via email. My email is in the last section of ReadMe.

I sent it to you.

@srikanth-lingala
Copy link
Owner

As mentioned in your post, the entry in this zip file is encrypted using Strong Encryption. Zip4j does not support Strong Encryption. Parts of this encryption are patented, and requires permission from PKWare. I will take this issue to improve zip4j's functionality to throw an exception with relevant message (that it is strong encrypted) instead of the exception message from your post.

@srikanth-lingala
Copy link
Owner

Can I use the test zip file you attached in a junit test case that I will add? If not, can you please create a zip with strong encryption that I can use for testing? This zip file will then be in the zip4j's repository here and will be used in a junit test.

@187nitro
Copy link
Author

187nitro commented Aug 19, 2020

Sorry I cant allow you to put this file in public with its password :( I will look forward to get an other or create one.

@srikanth-lingala
Copy link
Owner

Code change with a better exception message is done. But I cannot push it without a test case. I will be looking forward for the test zip file. Thanks.

@187nitro
Copy link
Author

Hi,

I cannot add a file here. Dont know why. I will send this file via mail.

@srikanth-lingala
Copy link
Owner

Got it. Thanks.

@oleg-cherednik
Copy link

PKWARE provides its own pkzip util. It has trial period. Uzing it you can create zip with strong encryption on yor own.

@srikanth-lingala
Copy link
Owner

Issue fixed in v2.6.2 released today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants