diff options
author | Christian Heimes <christian@cheimes.de> | 2013-07-21 00:04:44 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2013-07-21 00:04:44 (GMT) |
commit | 68959475705df9bae196e26c4d9ea82f2e2ca7ad (patch) | |
tree | 72d2740aeabb5890f3317b129655494e3d0f22f2 | |
parent | 8ded80d9096a160b35a5e68fbe8fb6863626abac (diff) | |
parent | c731bbe66545101069980fff4b89c45614b6fa9c (diff) | |
download | cpython-68959475705df9bae196e26c4d9ea82f2e2ca7ad.zip cpython-68959475705df9bae196e26c4d9ea82f2e2ca7ad.tar.gz cpython-68959475705df9bae196e26c4d9ea82f2e2ca7ad.tar.bz2 |
Propagate error when PyByteArray_Resize() fails in bytearray_translate()
CID 715334
-rw-r--r-- | Objects/bytearrayobject.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index d1b70e5..aa38924 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -1508,7 +1508,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) |