summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_io.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-05-28 13:24:45 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-05-28 13:24:45 (GMT)
commit37a79a12d1a9c337e0a8f7a12f11600c44be824f (patch)
tree5934412b8dd1754b4f959c3011284114e1bfe686 /Lib/test/test_io.py
parent12516e2c1b6dc577ea57ba45780637092afec671 (diff)
downloadcpython-37a79a12d1a9c337e0a8f7a12f11600c44be824f.zip
cpython-37a79a12d1a9c337e0a8f7a12f11600c44be824f.tar.gz
cpython-37a79a12d1a9c337e0a8f7a12f11600c44be824f.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.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index 6efd010..9b89202 100644
--- 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
+ 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