Issue 774221: 2.3c1: zipfile.py confused by garbage at the very end of zip (original) (raw)

Created on 2003-07-19 15:00 by nms, last changed 2022-04-10 16:10 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
zipfile.py.diffs nms,2003-07-19 15:00 Lib/zipfile.py patch for "garbage at the end of zip file" error
Messages (4)
msg44307 - (view) Author: Nikolai Saoukh (nms) Date: 2003-07-19 15:00
Some zip files can contain garbage past the End of Central Directory. _EndRecData() treat it as comment, thus failing sanity check for comment length.
msg44308 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2006-12-22 18:25
Under what circumstances do zip files have garbage appended to them? Are there buggy zipfile-generating programs out there, or does the garbage come from, say, an extra newline added when a zipfile is attached to an e-mail? The patch looks OK, but I'm nervous about adding code to silently ignore an incorrect zipfile.
msg59409 - (view) Author: Alan McIntyre (alanmcintyre) * (Python committer) Date: 2008-01-06 22:28
Since there's no reply about where ZIP files with appended 'garbage' might come from, should this be closed? I agree with amk; it doesn't seem wise to ignore incorrectly formatted files without a good reason. On a related note, it seems that correctly formatted ZIP files with comments longer than 4k will not be recognized as a ZIP file by the zipfile module. There's some comment about not looking at more than the last 4k of the file for "efficiency" reasons, but failing to interpret a correct file seems to override the efficiency concern of reading/searching another 60k of data. I'll open a separate tracker item for this, since it's not strictly related to the original issue.
msg60161 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2008-01-19 14:00
I searched for references to 'zip file concatenate|append' and found no reference to extra data being ignored, so I'll agree with Alan and close this patch. Thanks for your contribution, anyway!
History
Date User Action Args
2022-04-10 16:10:02 admin set github: 38877
2008-01-19 14:00:04 akuchling set status: open -> closedresolution: rejectedmessages: +
2008-01-06 22:28:43 alanmcintyre set nosy: + alanmcintyremessages: +
2003-07-19 15:00:48 nms create