diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2016-10-25 10:18:16 +0300 |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-10-25 10:18:16 +0300 |
| commit | d7e5ff13bb7e6d7f46390f7f6284f30539475d68 (patch) | |
| tree | 773b644d15cc556fef459054e64a73a4ca1d55c3 /Objects/unicodeobject.c | |
| parent | e402312499a04032e998ef4e280e51f8bb1ebb9b (diff) | |
| parent | c4a3e90aa8903d35a7b07e751a878fbd8326799e (diff) | |
| download | cpython-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.c | 12 |
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 * |
