mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
Issue #18025: Fixed a segfault in io.BufferedIOBase.readinto() when raw
stream's read() returns more bytes than requested.
This commit is contained in:
parent
12516e2c1b
commit
37a79a12d1
3 changed files with 20 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue