libzip: libzip-discuss: Re: Possible bug with file >2gb

Thread

Thread Index

Message

From: Andrew Brampton <brampton%gmail.com@localhost>
To: libzip-discuss%nih.at@localhost
Subject: Re: Possible bug with file >2gb
Date: Sun, 30 May 2010 16:04:22 +0100

On 30 May 2010 13:17, Andrew Brampton <brampton%gmail.com@localhost> wrote:
> Hi,
> I've tried to debug this the best I can, but I've now got stuck
> because I'm unfamiliar with the code.
> [snip]
>

Ok, I've done some more digging and I think I've found the problem. In
_zip_readcdir when it works out where cdp should point it uses:
cdp = eocd - cd->size;
which assumes the directory entries are just in front of the end of
central directory . However, doing a bit of maths I found there is 76
bytes between the last directory entry and the EOCD. Firing up my hex
editor I see there are two records, a PK\6\6 and a PK\6\7, which after
a quick search appear to be zip64 records.

If I understand it correctly libzip does not support zip64 yet, but
regardless I think the assumption that the directory entries
immediately proceed the EOCD is no longer valid, and instead the
cd->offset field should be used. I will try and create a patch to this
effect and see if I can get my zip useable.

On a side note, the zip files which were less than 2GB do not have
these zip64 records, so I assume whatever tool is producing the files
only inserts the records on >2GB files.

thanks
Andrew

Made by MHonArc.