changeset: 104691:71dce630dc02 branch: 3.4 parent: 104448:d7b9ce8ae79b user: Serhiy Storchaka date: Tue Oct 25 10:07:51 2016 +0300 files: Misc/NEWS Objects/unicodeobject.c description: Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug build. diff -r d7b9ce8ae79b -r 71dce630dc02 Misc/NEWS --- a/Misc/NEWS Mon Oct 10 21:57:20 2016 -0500 +++ b/Misc/NEWS Tue Oct 25 10:07:51 2016 +0300 @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug + build. + Library ------- diff -r d7b9ce8ae79b -r 71dce630dc02 Objects/unicodeobject.c --- a/Objects/unicodeobject.c Mon Oct 10 21:57:20 2016 -0500 +++ b/Objects/unicodeobject.c Tue Oct 25 10:07:51 2016 +0300 @@ -3059,24 +3059,16 @@ 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 *