summaryrefslogtreecommitdiff
path: root/Lib/test/test_io.py
diff options
context:
space:
mode:
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 6efd010561..9b8920211e 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