[issue10694] zipfile.py end of central directory detection not robust

Kevin Hendricks report at bugs.python.org
Tue Dec 14 16:22:25 CET 2010


Kevin Hendricks <kevin.hendricks at sympatico.ca> added the comment:

If you read the bug report it explains how to generate a testcase (i.e. append any data to the end of a zip archive)

Here it is as a step by step process 

1. simply take any working zip and call it testcase.zip 

2. do the following:

echo "\r\n" >> testcase.zip 

If you run "unzip -t" on testcase.zip it will pass with flying colors and will properly unzip on every piece of zip software I have tried.

However if you try to use python to copy the zip archive to another zip archive

python ./zipfix.py testcase.zip junk.zip
Error Occurred  File is not a zip file

All because of the appended carriage return / linefeed at the end.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10694>
_______________________________________


More information about the Python-bugs-list mailing list