cpython/Modules/_io
Philipp Gesang cb1c0746f2
closes bpo-39510: Fix use-after-free in BufferedReader.readinto() (GH-18295)
When called on a closed object, readinto() segfaults on account
of a write to a freed buffer:

    ==220553== Process terminating with default action of signal 11 (SIGSEGV): dumping core
    ==220553==  Access not within mapped region at address 0x2A
    ==220553==    at 0x48408A0: memmove (vg_replace_strmem.c:1272)
    ==220553==    by 0x58DB0C: _buffered_readinto_generic (bufferedio.c:972)
    ==220553==    by 0x58DCBA: _io__Buffered_readinto_impl (bufferedio.c:1053)
    ==220553==    by 0x58DCBA: _io__Buffered_readinto (bufferedio.c.h:253)

Reproducer:

    reader = open ("/dev/zero", "rb")
    _void  = reader.read (42)
    reader.close ()
    reader.readinto (bytearray (42)) ### BANG!

The problem exists since 2012 when commit dc469454ec added code
to free the read buffer on close().

Signed-off-by: Philipp Gesang <philipp.gesang@intra2net.com>
2020-02-04 13:25:16 -08:00
..
clinic bpo-37330: open() no longer accept 'U' in file mode (GH-16959) 2019-10-28 15:40:08 +01:00
_iomodule.c Revert "remove a strange non-ASCII character in _iomodule.c" (GH-17240) 2019-11-18 21:19:51 +02:00
_iomodule.h bpo-11410: Standardize and use symbol visibility attributes across POSIX and Windows. (GH-16347) 2019-10-15 08:26:12 +01:00
bufferedio.c closes bpo-39510: Fix use-after-free in BufferedReader.readinto() (GH-18295) 2020-02-04 13:25:16 -08:00
bytesio.c bpo-11410: Standardize and use symbol visibility attributes across POSIX and Windows. (GH-16347) 2019-10-15 08:26:12 +01:00
fileio.c closes bpo-27805: Ignore ESPIPE in initializing seek of append-mode files. (GH-17112) 2019-11-12 14:51:34 -08:00
iobase.c bpo-37337: Add _PyObject_CallMethodNoArgs() (GH-14267) 2019-07-08 17:19:25 +09:00
stringio.c bpo-15999: Clean up of handling boolean arguments. (GH-15610) 2019-09-01 12:16:51 +03:00
textio.c bpo-37206: Unrepresentable default values no longer represented as None. (GH-13933) 2019-09-14 12:24:05 +03:00
winconsoleio.c bpo-37547: Fix a compiler warning in winconsoleio.c (GH-14785) 2019-07-19 15:07:06 +09:00