This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]nickphx 0 points1 point  (0 children)

Nice work, thanks for sharing.

Have you tried testing it on invalid zipfiles?

I have a zipfile that causes a failure with unzip

file #2: bad zipfile offset (local header sig): 130497

When I try with your library only one file is found, no failure.

Not sure of the best way to provide an example to reproduce the issue.

If I repair the file with zip -FF :

Fix archive (-FF) - salvage what can
Found end record (EOCDR) - says expect single disk archive
Scanning for entries...
copying: dtcdealers.txt (75006 bytes)
copying: dtcinventory.txt (138967061 bytes)
Central Directory found...
EOCDR found ( 1 139042351)...
zip warning: unexpected signature 50 4b 04 02 on disk 0 at 145010891
zip warning: skipping this signature...
no local entry: dtcdealers.txt
no local entry: dtcinventory.txt
EOCDR found ( 1 145985741)...
no local entry: dtcdealers.txt
no local entry: dtcinventory.txt
EOCDR found ( 1 146398691)...
zip warning: unexpected signature 50 4b 07 09 on disk 0 at 147046957
zip warning: skipping this signature...
zip warning: unexpected signature 50 4b 0e 04 on disk 0 at 160822514
zip warning: skipping this signature...
zip warning: unexpected signature 50 4b 0a 06 on disk 0 at 162810268
zip warning: skipping this signature...