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

Error at the end of zipping: ushort format requires 0 <= number <= (0x7fff * 2 + 1) #9

Open
treasan opened this issue Jan 2, 2022 · 1 comment

Comments

@treasan
Copy link

treasan commented Jan 2, 2022

Hey,
I'm getting an error at the end of zipping a larger amount of files (~80.000 files, totaling ~ 1GB).

ushort format requires 0 <= number <= (0x7fff * 2 + 1)
  File ".../zipstream/zipstream.py", line 228, in _make_cdend
    cdend = consts.CD_END_STRUCT.pack(*cdend)
  File ".../zipstream/zipstream.py", line 241, in _make_end_structures
    yield self._make_cdend()
  File ".../zipstream/zipstream.py", line 306, in stream
    for chunk in self._make_end_structures():
@michalc
Copy link

michalc commented Jan 20, 2022

(I'm not involved with this project, am just interested in zip files for some reason...)

I think that non-zip64 zip files are limited to a maximum of 2^16 - 1 = 65535 = 0xffff = 0x7fff * 2 + 1 member files, since the number of member files must be stored in an unsigned integer 2 bytes long. If you go to APPNOTE.TXT and search for "End of central directory record" you should see that "total number of entries in the central directory" is a 2 byte field.

zip64 has a much bigger limit, but looking in the README and around the code, it looks like zip64 isn't supported. Often zip64 is described as having a bigger total size limit - it does, but it also has a bigger limit on number of files that can be stored in the zip.

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

2 participants