diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-05-28 13:27:08 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-05-28 13:27:08 (GMT) |
commit | 281945f42720e61bd4c373b37e379713b8a10037 (patch) | |
tree | 673c51692f683f3971930fddb62d8e6d556207fc /Lib/test/test_io.py | |
parent | 5758fa78d0af2ca4cbbb819797372d055bb7faa1 (diff) | |
parent | 37a79a12d1a9c337e0a8f7a12f11600c44be824f (diff) | |
download | cpython-281945f42720e61bd4c373b37e379713b8a10037.zip cpython-281945f42720e61bd4c373b37e379713b8a10037.tar.gz cpython-281945f42720e61bd4c373b37e379713b8a10037.tar.bz2 |
Issue #18025: Fixed a segfault in io.BufferedIOBase.readinto() when raw
stream's read() returns more bytes than requested.
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r-- | Lib/test/test_io.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index 44e5cad..5fb68b4 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -3027,6 +3027,15 @@ class MiscIOTest(unittest.TestCase): class CMiscIOTest(MiscIOTest): io = io + def test_readinto_buffer_overflow(self): + # Issue #18025 + class BadReader(self.io.BufferedIOBase): + def read(self, n=-1): + return b'x' * 10**6 + bufio = BadReader() + b = bytearray(2) + self.assertRaises(ValueError, bufio.readinto, b) + class PyMiscIOTest(MiscIOTest): io = pyio |