Commit cc024d18 authored by Victor Stinner's avatar Victor Stinner

Issue #18408: Fix iobase_readline(), handle PyByteArray_Resize() failure

parent af8b7e82
......@@ -530,7 +530,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));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment