pixelglow / ZipZap

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

ZZEndOfCentralDirectoryReadErrorCode Error #138

Closed joshfuggle closed 8 years ago

joshfuggle commented 8 years ago

Hello,

My name is Josh and I have been using your library for some time. Firstly, I would like to say that it is fantastic.

Recently, I have had error reports from users, which I have worked this out to be something going wrong with our zipping code. Specifically, I am getting an ZZEndOfCentralDirectoryReadErrorCode from the ZipZap library.

I was wondering if you could explain what an End of Central Directory Read error is and in what circumstances it can occur.

Thanks in advance for any insights you can offer.

Cheers

pixelglow commented 8 years ago

When the library opens a zip file, it performs several sanity checks that get lumped under ZZEndOfCentralDirectoryReadErrorCode at ZZArchive.mm:124-139:

If you need to figure out which one is tripping the sanity check, put a breakpoint in the code and it should come up. In particular, I've seen a few zip files with extra bytes after the end which trip this error.

atetlaw commented 8 years ago

Hi @pixelglow , If this error is returned, when attempting to create a zip file from a directory (on iOS), does it indicate something different?

Thanks, Andrew

pixelglow commented 8 years ago

@atetlaw, if you create or update a zip file, the library does attempt to re-read the directory structures again so that could indicate a corrupted zip file or some bad write by the library code. If you can reproduce the error, would appreciate a minimal Xcode project showing the error.

joshfuggle commented 8 years ago

@pixelglow We have recently upgraded from ZipZap version 8.0.4 to 8.1.1. Have there been any changes that could result in zipping issues?

pixelglow commented 8 years ago

@josh-fuggle: you can try looking through the compare view. We do have a commit that emits a ZZCentralFileHeaderReadErrorCode but not a ZZEndOfCentralDirectoryReadErrorCode. Does your existing code work correctly with 8.0.4?

joshfuggle commented 8 years ago

We haven't seen any reports of this particular issue before, now we have reports from 4 separate devices. All on recent versions of our app.

atetlaw commented 8 years ago

Thanks for your help @pixelglow, @josh-fuggle is now working out a way to get the customer data off their device. Hopefully we'll discover the cause and then we may be able to make a test case.

Will let you know what we find.

pixelglow commented 8 years ago

It's been 2 months since the last message, so I'm considering this issue closed.