summaryrefslogtreecommitdiff
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-10-25 10:18:16 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2016-10-25 10:18:16 +0300
commitd7e5ff13bb7e6d7f46390f7f6284f30539475d68 (patch)
tree773b644d15cc556fef459054e64a73a4ca1d55c3 /Objects/unicodeobject.c
parente402312499a04032e998ef4e280e51f8bb1ebb9b (diff)
parentc4a3e90aa8903d35a7b07e751a878fbd8326799e (diff)
downloadcpython-git-d7e5ff13bb7e6d7f46390f7f6284f30539475d68.tar.gz
Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug build.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index cd8b33c594..75c5e86941 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -3232,24 +3232,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 *