From c731bbe66545101069980fff4b89c45614b6fa9c Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Sun, 21 Jul 2013 02:04:35 +0200 Subject: [PATCH] Propagate error when PyByteArray_Resize() fails in bytearray_translate() CID 715334 --- Objects/bytearrayobject.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index 9f1cf0a1f7f..60b281179d9 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)