Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty ZIP files not recognized #23

Open
sandrock opened this issue Aug 3, 2018 · 1 comment
Open

Empty ZIP files not recognized #23

sandrock opened this issue Aug 3, 2018 · 1 comment

Comments

@sandrock
Copy link

sandrock commented Aug 3, 2018

Empty ZIP files are a special kind of ZIP. The header differs.

File contents: 50 4b 05 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Calling GetFileType(this byte[] bytes) returns null.

$ file -i ZIPempty.zip
ZIPempty.zip: application/zip; charset=binary
@sandrock
Copy link
Author

sandrock commented Aug 7, 2018

A ZIP header should start with 0x04034b50 but mine starts with 0x06054b50.

.ZIP File Format Specification at section "4.3.16 End of central directory record" says that my header looks like a "end of central dir signature".

Steps to recreate this file:

  • have 7Zip on your machine
  • using windows explorer, select a file, context menu, 7zip, "add to .zip archive"
  • open the archive using 7zip and delete the files

Do you think this makes a corrupted zip? Or is it legit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant