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

I cannot unpack this zip file #6

Open
JCash opened this issue Sep 10, 2020 · 3 comments
Open

I cannot unpack this zip file #6

JCash opened this issue Sep 10, 2020 · 3 comments

Comments

@JCash
Copy link

JCash commented Sep 10, 2020

Thanks for this tiny little library.
I'd really like to use it, but unfortunately, it doesn't seem to work on my zip file.

The file is created using Java on OSX (java.util.zip.ZipOutputStream).

I built the tools using HAVE_LIBS=1.

Here's what the tools say:

work/external/JUnzip $ ./junzip_demo ~/work/projects/users/mawe/test_bundles/defold.resourcepack_x86_64-darwin_1991398657492922735.zip
972871ffae57ab50d9de02a4f1feb2abb5449bf2, 0 / 0 bytes at offset 00000000
Couldn't read file data!7956da274644c976bbbcddc6297a69393036abce, 0 / 0 bytes at offset 00000000
Couldn't read file data!9e1e445ecb6ab1af9ca2c36af28c02348973c0dd, 0 / 0 bytes at offset 00000000
Couldn't read file data!6ca35f8e1835e32bfebaf64bc1b4a3825e04a6e7, 0 / 0 bytes at offset 00000000
Couldn't read file data!liveupdate.game.dmanifest, 0 / 0 bytes at offset 00000000
Couldn't read file data!a6204fe4626d2c87721c4876713306224ade2ca1, 0 / 0 bytes at offset 00000000
Couldn't read file data!%

work/external/JUnzip $ ./junzip_dump ~/work/projects/users/mawe/test_bundles/defold.resourcepack_x86_64-darwin_1991398657492922735.zip
Reading files...
[E168E168] File "972871ffae57ab50d9de02a4f1feb2abb5449bf2" found, 0 bytes (0 compressed), skipping data...
    signature: 0x04034B50
    versionNeededToExtract: 20
    generalPurposeBitFlag: 2056
    compressionMethod: 8
    lastModFileTime: 0x5EE8 (11:55:16)
    lastModFileDate: 0x512A (2020/09/10)
    crc32: 0x00000000
    compressedSize: 0
    uncompressedSize: 0
    fileNameLength: 40
    extraFieldLength: 0
Read of local file header failed, assuming file data ended.
Invalid file header signature 0![00000046] %  

Here is the zip file:
defold.resourcepack_x86_64-darwin_1991398657492922735.zip

@r-lyeh
Copy link

r-lyeh commented Sep 11, 2020

Hey JCash, if it is of any help I did fix a few issues in JUnzip while working in a forked source (see https://github.com/r-lyeh/stdarc.c/blob/master/src/zip.c which can succesfully unzip your file)

Unfortunatelly, bringing the fixes back to the original source will require some extra work, as the codebase had diverged quite a lot when I found the unzipping issues.

Hope that helps in any case, as most of the JUnzip functions and related structs are still there somehow :o)

PS: so far I've tested more than 2,000 different zip files from the net and found no errors so far, so I'm pretty confident the fixes are good.

@jokkebk
Copy link
Owner

jokkebk commented Feb 14, 2021

@r-lyeh do you remember what kind of things there were regarding .zip files (are there version differences, or do some zippers leave CRC out, or if there were bugs in JUnzip) that did not work with JUnzip and you fixed? I could maybe take a look if there are some pointers fresh in your mind. :) Very cool to see the project in use in any case!

@r-lyeh
Copy link

r-lyeh commented Feb 14, 2021

Hey Joonas. Sure! There are at least two archived fixes in the history of this file:
https://github.com/r-lyeh/stdpack.c/commits/afa792d8be27e77cde0e1a2fef034b481feb9597/src/zip.c
(I dont remember if I fixed anything else beforehand, while creating the initial revision of that zip.c file though)

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

3 participants