This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ymgve
Recipients ymgve
Date 2009-01-05.15:24:09
SpamBayes Score 0.000575851
Marked as misclassified No
Message-id <>
If you have a .zip file with an incomplete "End of Central Directory" 
record, _EndRecData() will throw a struct.error:

D:\c64workdir\Ultimate_Mag_Archive> "old - 
Handling A-z\0\
Traceback (most recent call last):
  File "E:\wwwroot\c64db\tools\", line 48, in <module>
    ok = handle_file(data, rel_filename)
  File "E:\wwwroot\c64db\tools\", line 19, in handle_file
    z = zipfile.ZipFile(cStringIO.StringIO(data), "r")
  File "C:\Python26\lib\", line 698, in __init__
  File "C:\Python26\lib\", line 718, in _GetContents
  File "C:\Python26\lib\", line 728, in _RealGetContents
    endrec = _EndRecData(fp)
  File "C:\Python26\lib\", line 219, in _EndRecData
    endrec = list(struct.unpack(structEndArchive, recData))
struct.error: unpack requires a string argument of length 22

The fix is to include a check to see if there is data enough for the 
whole record before attempting to unpack.
Date User Action Args
2009-01-05 15:24:11ymgvesetrecipients: + ymgve
2009-01-05 15:24:11ymgvesetmessageid: <>
2009-01-05 15:24:10ymgvelinkissue4844 messages
2009-01-05 15:24:09ymgvecreate