cpython: b864f4056b78 (original) (raw)
Mercurial > cpython
changeset 83955:b864f4056b78 3.3
Issue #18025: Fixed a segfault in io.BufferedIOBase.readinto() when raw stream's read() returns more bytes than requested. [#18025]
Serhiy Storchaka storchaka@gmail.com | |
---|---|
date | Tue, 28 May 2013 16:24:45 +0300 |
parents | b98380a1d979 |
children | ad56dff3602f 0889ab0d0da1 |
files | Lib/test/test_io.py Misc/NEWS Modules/_io/bufferedio.c |
diffstat | 3 files changed, 20 insertions(+), 0 deletions(-)[+] [-] Lib/test/test_io.py 9 Misc/NEWS 3 Modules/_io/bufferedio.c 8 |
line wrap: on
line diff
--- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -3019,6 +3019,15 @@ class MiscIOTest(unittest.TestCase): class CMiscIOTest(MiscIOTest): io = io
- def test_readinto_buffer_overflow(self):
# Issue #18025[](#l1.8)
class BadReader(self.io.BufferedIOBase):[](#l1.9)
def read(self, n=-1):[](#l1.10)
return b'x' * 10**6[](#l1.11)
bufio = BadReader()[](#l1.12)
b = bytearray(2)[](#l1.13)
self.assertRaises(ValueError, bufio.readinto, b)[](#l1.14)
+ class PyMiscIOTest(MiscIOTest): io = pyio
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -24,6 +24,9 @@ Core and Builtins Library ------- +- Issue #18025: Fixed a segfault in io.BufferedIOBase.readinto() when raw
- Issue #18011: base64.b32decode() now raises a binascii.Error if there are non-alphabet characters present in the input string to conform a docstring. Updated the module documentation.
--- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -69,6 +69,14 @@ bufferediobase_readinto(PyObject *self, } len = Py_SIZE(data);