From: Christian Heimes Date: Sun, 21 Jul 2013 00:04:35 +0000 (+0200) Subject: Propagate error when PyByteArray_Resize() fails in bytearray_translate() X-Git-Tag: v3.4.0a1~122^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c731bbe66545101069980fff4b89c45614b6fa9c;p=thirdparty%2FPython%2Fcpython.git Propagate error when PyByteArray_Resize() fails in bytearray_translate() CID 715334 --- diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index 9f1cf0a1f7f7..60b281179d9b 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -1506,7 +1506,10 @@ bytearray_translate(PyByteArrayObject *self, PyObject *args) } /* Fix the size of the resulting string */ if (inlen > 0) - PyByteArray_Resize(result, output - output_start); + if (PyByteArray_Resize(result, output - output_start) < 0) { + Py_CLEAR(result); + goto done; + } done: if (tableobj != NULL)