diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-10-25 07:07:51 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-10-25 07:07:51 (GMT) |
commit | 77eede35fc4409f3279af0fee91fdfb3fcc5a6ae (patch) | |
tree | c362437c4771a6989f9a099a711683d5aadd7d64 /Objects | |
parent | 068534ab037236aa80d489383aded87c28553eb0 (diff) | |
download | cpython-77eede35fc4409f3279af0fee91fdfb3fcc5a6ae.zip cpython-77eede35fc4409f3279af0fee91fdfb3fcc5a6ae.tar.gz cpython-77eede35fc4409f3279af0fee91fdfb3fcc5a6ae.tar.bz2 |
Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug build.
Diffstat (limited to 'Objects')
-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 193d898..7fad695 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -3059,24 +3059,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 * |