New submission from Ryan Kelly <r...@rfk.id.au>:

If you open a ZipFile in append mode and modify the comment to be shorter than 
what was originally there, the file will become corrupted.  Truncated data from 
the original comment is left "dangling" at the end of the zipfile.

A much more trivial bug discovered while writing tests for this: setting the 
"comment" attribute doesn't mark the zipfile as modified, so the change won't 
be written out unless you also modify one of the archive files.

The attached patch fixes (and adds tests for) these issues.

----------
components: Library (Lib)
files: zipfile_appendmode_comment.patch
keywords: patch
messages: 110149
nosy: rfk
priority: normal
severity: normal
status: open
title: zipfile: truncating comment can corrupt the zipfile
type: performance
versions: Python 3.2
Added file: http://bugs.python.org/file17974/zipfile_appendmode_comment.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9239>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to