summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-10-25 07:13:43 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-10-25 07:13:43 (GMT)
commit839023f12cd589a25e7e9e2ee1ed64485ab45fd9 (patch)
tree12de05efcf1d1e6e07027c0f54a0a72aa7bd792e /Objects
parentbc51a8af254ddc2c5074cc3914ffc818f401923c (diff)
parent77eede35fc4409f3279af0fee91fdfb3fcc5a6ae (diff)
downloadcpython-839023f12cd589a25e7e9e2ee1ed64485ab45fd9.zip
cpython-839023f12cd589a25e7e9e2ee1ed64485ab45fd9.tar.gz
cpython-839023f12cd589a25e7e9e2ee1ed64485ab45fd9.tar.bz2
Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug build.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 19549cd..273536e 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -3026,24 +3026,16 @@ PyUnicode_AsDecodedObject(PyObject *unicode,
const char *encoding,
const char *errors)
{
- PyObject *v;
-
if (!PyUnicode_Check(unicode)) {
PyErr_BadArgument();
- goto onError;
+ return NULL;
}
if (encoding == NULL)
encoding = PyUnicode_GetDefaultEncoding();
/* Decode via the codec registry */
- v = PyCodec_Decode(unicode, encoding, errors);
- if (v == NULL)
- goto onError;
- return unicode_result(v);
-
- onError:
- return NULL;
+ return PyCodec_Decode(unicode, encoding, errors);
}
PyObject *