summaryrefslogtreecommitdiff
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-10-25 10:17:33 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2016-10-25 10:17:33 +0300
commitc4a3e90aa8903d35a7b07e751a878fbd8326799e (patch)
treef12630f5b09c33626d1652914b0096caa9e3b922 /Objects/unicodeobject.c
parentb1f52879528283483b26a11b24b306c90db1169d (diff)
parent839023f12cd589a25e7e9e2ee1ed64485ab45fd9 (diff)
downloadcpython-git-c4a3e90aa8903d35a7b07e751a878fbd8326799e.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 80e6cf26f8..4c951118ce 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -3236,24 +3236,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 *