Message149109
| Author |
ahlstromjc |
| Recipients |
Ernst.Sjöstrand, ahlstromjc, alanmcintyre, antitree, arkanes, flox, georg.brandl, markhirota, r.david.murray |
| Date |
2011年12月09日.17:11:06 |
| SpamBayes Score |
3.558504e-08 |
| Marked as misclassified |
No |
| Message-id |
<1323450667.55.0.103263455755.issue1757072@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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) |
|