summaryrefslogtreecommitdiffstats
path: root/Objects/bytearrayobject.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-07-21 00:04:35 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-07-21 00:04:35 (GMT)
commitc731bbe66545101069980fff4b89c45614b6fa9c (patch)
treec8d73403b5b0026ffc073900cdc2dfeee921c2c7 /Objects/bytearrayobject.c
parent8e0908495a0588cee8620a7a8081f9b17b930baf (diff)
downloadcpython-c731bbe66545101069980fff4b89c45614b6fa9c.zip
cpython-c731bbe66545101069980fff4b89c45614b6fa9c.tar.gz
cpython-c731bbe66545101069980fff4b89c45614b6fa9c.tar.bz2
Propagate error when PyByteArray_Resize() fails in bytearray_translate()
CID 715334
Diffstat (limited to 'Objects/bytearrayobject.c')
-rw-r--r--Objects/bytearrayobject.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
index 9f1cf0a..60b2811 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)