James C. Ahlstrom <[email protected]> added the comment:
I grabbed a 2.7.2 zipfile.py, and my original comments stand. If there is a
"garbage at end of file" patch, I can't find it; please provide a line number
or a hint. The user at yale.edu reports that the patch works. Here is a diff
of my changes. To test, append some junk to a good zipfile: echo junk >>
good.zip, and try reading it. Let me know if you want me to do anything else;
maybe look at 3.2; or email me offline.
*** zipfile.py 2011-12-09 11:25:07.000000000 -0500
--- ../zipfile.py 2011-12-09 05:48:00.000000000 -0500
***************
*** 237,248 ****
recData = data[start:start+sizeEndCentDir]
endrec = list(struct.unpack(structEndArchive, recData))
comment = data[start+sizeEndCentDir:]
! ## Remove # check that comment length is correct
! ## Remove if endrec[_ECD_COMMENT_SIZE] == len(comment):
! # check that the offset to the Central Directory points to a valid
item
! fpin.seek(endrec[_ECD_OFFSET], 0)
! dat = fpin.read(4)
! if dat == stringCentralDir:
# Append the archive comment and start offset
endrec.append(comment)
endrec.append(maxCommentStart + start)
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue1757072>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com