pixelglow / ZipZap

zip file I/O library for iOS, macOS and tvOS
BSD 2-Clause "Simplified" License
1.22k stars 199 forks source link

Unable to unzip own files #64

Closed rhummelmose closed 10 years ago

rhummelmose commented 10 years ago

Hi there.

I just integrated zip zap in our core, it usually works, but some of the files zipped by zipzap cannot be unzipped again, by zip zap. Ironically OSX can unzip the files without issues.

I set up a simple test project to display the issue of one of the files in question. You can find it here: https://wallmob.box.com/s/nt9q6yfmhqlnl574823q

pixelglow commented 10 years ago

Thanks for submitting a nicely isolated test case, it definitely helped me figure out what's going on!

The -[ZZArchive load:] call returned a ZZEndOfCentralDirectoryReadErrorCode since it detected a faulty end of central directory. Your error.zip file actually contains an extraneous two bytes 0d 0a (CRLF?) at the end, which then made the end of central header fail a sanity check for length.

I can't see out any place in my own zipping code that would write these extra bytes. Perhaps your own code is appending it? Please isolate a test case for the zip side and I can look at it.

zipinfo and unzip -t all pass your error.zip file. If we can find a clause in the PKZip appnote that allows for extra bytes at the end, I can relax the sanity check on my side.

Alternatively if you were looking to add zip comments, we can work on that too. In particular we would need to update the zip comment length; at the moment it's hardcoded to write out a zero length.

pixelglow commented 10 years ago

No further progress.