check the result of PyByteArray_Resize in readline() (closes #27211)
This commit is contained in:
parent
bbf29ee6e4
commit
a48aa85da0
|
@ -89,6 +89,8 @@ Core and Builtins
|
|||
Library
|
||||
-------
|
||||
|
||||
- Issue #27211: Fix possible memory corruption in io.IOBase.readline().
|
||||
|
||||
- Issue #27114: Fix SSLContext._load_windows_store_certs fails with
|
||||
PermissionError
|
||||
|
||||
|
|
|
@ -529,7 +529,10 @@ iobase_readline(PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
old_size = PyByteArray_GET_SIZE(buffer);
|
||||
PyByteArray_Resize(buffer, old_size + PyBytes_GET_SIZE(b));
|
||||
if (PyByteArray_Resize(buffer, old_size + PyBytes_GET_SIZE(b)) < 0) {
|
||||
Py_DECREF(b);
|
||||
goto fail;
|
||||
}
|
||||
memcpy(PyByteArray_AS_STRING(buffer) + old_size,
|
||||
PyBytes_AS_STRING(b), PyBytes_GET_SIZE(b));
|
||||
|
||||
|
|
Loading…
Reference in New Issue