Kevin Hendricks <[email protected]> added the comment:
Here is one potential patch. It simply incorporates and non-comment extraneous
data into a final comment so that nothing is lost. Another solution that might
be safer, would be to truncate the zip archive immediately after the endrec is
found if the extraneous data is not a properly formatted comment. The right
solution is obviously up to the developers of zipfile.py
--- zipfile_orig.py 2010-12-14 10:23:58.000000000 -0500
+++ zipfile.py 2010-12-14 10:30:21.000000000 -0500
@@ -228,6 +228,13 @@
# structure present, so go look for it
return _EndRecData64(fpin, start - filesize, endrec)
return endrec
+ else :
+ # be robust to non-comment extaneous data after endrec
+ # by making it a comment so that nothing is ever lost
+ endrec[_ECD_COMMENT_SIZE] = len(comment)
+ endrec.append(comment)
+ endrec.append(maxCommentStart + start)
+ return endrec
# Unable to find a valid end of central directory structure
return
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue10694>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com