JUnzip icon indicating copy to clipboard operation
JUnzip copied to clipboard

I cannot unpack this zip file

Open JCash opened this issue 4 years ago • 3 comments

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

JCash avatar Sep 10 '20 10:09 JCash

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.

r-lyeh avatar Sep 11 '20 21:09 r-lyeh

@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!

jokkebk avatar Feb 14 '21 10:02 jokkebk

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)

r-lyeh avatar Feb 14 '21 15:02 r-lyeh