diff options
author | Guido van Rossum <guido@python.org> | 2000-10-12 16:45:37 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-10-12 16:45:37 (GMT) |
commit | b636dc67ed3c351d9631a7900ea05c3394a99518 (patch) | |
tree | abc7c1192f0a6fd47535a4d92df8fba3daee6216 /Lib | |
parent | 2e2a70abe48d84846fde5e9a64450f8b0c9934b2 (diff) | |
download | cpython-b636dc67ed3c351d9631a7900ea05c3394a99518.zip cpython-b636dc67ed3c351d9631a7900ea05c3394a99518.tar.gz cpython-b636dc67ed3c351d9631a7900ea05c3394a99518.tar.bz2 |
[ Bug #116636 ] Bug in StringIO.write()
http://sourceforge.net/bugs/?func=detailbug&bug_id=116636&group_id=5470
bobalex@rsv.ricoh.com
Bug report: If the file position is less than the end of the "file",
and a write is performed extending past then end of the file, the data
string is corrupted.
Solution: in write(), when writing past the end, properly set self.len
when newpos is > self.len.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/StringIO.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/StringIO.py b/Lib/StringIO.py index 334bf85..6952b1a 100644 --- a/Lib/StringIO.py +++ b/Lib/StringIO.py @@ -129,6 +129,8 @@ class StringIO: self.buflist = [] self.buflist = [self.buf[:self.pos], s, self.buf[newpos:]] self.buf = '' + if newpos > self.len: + self.len = newpos else: self.buflist.append(s) self.len = newpos |