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

Unable to extract files from ZIP file with version 45 #1

Open
bjorn opened this issue Mar 31, 2015 · 6 comments
Open

Unable to extract files from ZIP file with version 45 #1

bjorn opened this issue Mar 31, 2015 · 6 comments

Comments

@bjorn
Copy link
Contributor

bjorn commented Mar 31, 2015

This code apparently only supports ZIP files up to version "20", and the file I tried to read with it appears to be version "45". This results in the message:

QZip: .ZIP specification version 45 implementationis needed to extract the data.

I know this library is unmaintained and only meant as a starting point for a full featured ZIP file reader/writer for Qt, but I thought I'd document this shortcoming here for reference.

@nezticle
Copy link
Owner

Good catch. It should be possible to update the version of zlib in src/3rdparty, but I've not tried to do so and there may be some problems I've not forseen

@bjorn
Copy link
Contributor Author

bjorn commented Mar 31, 2015

Actually I'm using the zlib that ships with Qt which appears to be version 1.2.5 as well. I'm not sure why Qt ships with such an old zlib header, but on the other hand I doubt a little that this would be the reason for the incompatibility since there's just patch releases in between.

@bjorn
Copy link
Contributor Author

bjorn commented Mar 31, 2015

According to:

https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.3.TXT

The version 45 means "File uses ZIP64 format extensions".

@nezticle
Copy link
Owner

ah, so likely some "real" work to change how we are using zlib

@bjorn
Copy link
Contributor Author

bjorn commented Mar 31, 2015

Well, I've hacked it up to get it to work with my zip file. Will look into opening a pull request later, though it'll be mainly to show the rough changes because for sure it won't have all the proper error handling in place.

In my case I did not need to change anything regarding the way zlib is used, because the actual ZIP file did not contain any files larger than 4 GB. Rather it was for whatever reason using this ZIP64 extension to store the compressed and uncompressed file systems in an extra field. This is valid according to the standard, and it seems to be not too complicated to support that.

I think actually supporting larger amounts of data would be really hard, maybe impossible with the current API. The reason being that QByteArray can't store more than about 2 GB of data, or am I missing something? It just uses 'int' for its size, at least.

Also, zip version 2.7 added a "File is a patch data set" flag that will now probably need to be reported as unsupported.

@bjorn
Copy link
Contributor Author

bjorn commented Mar 31, 2015

For future reference, this could be useful for implementing full ZIP64 support since it contains some useful links and patches to OpenJDK that added support for that:

https://blogs.oracle.com/xuemingshen/entry/zip64_support_for_4g_zipfile

bjorn added a commit to bjorn/qtcompress that referenced this issue May 31, 2015
This is probably not complete and it's not well tested, but it allowed
me to open a zip file with version 45 that was using the ZIP64 extension.

GitHub-issue: nezticle#1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants