]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Propagate error when PyByteArray_Resize() fails in bytearray_translate()
authorChristian Heimes <christian@cheimes.de>
Sun, 21 Jul 2013 00:04:35 +0000 (02:04 +0200)
committerChristian Heimes <christian@cheimes.de>
Sun, 21 Jul 2013 00:04:35 +0000 (02:04 +0200)
CID 715334

Objects/bytearrayobject.c

index 9f1cf0a1f7f754a378f209b99102e382d37e4b85..60b281179d9ba91ae86311eb67fcf01c30928bfd 100644 (file)
@@ -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)