changeset: 104693:6af1a26e655f branch: 3.6 parent: 104688:603ac788ed27 parent: 104692:74569ecd67e4 user: Serhiy Storchaka date: Tue Oct 25 10:17:33 2016 +0300 files: Misc/NEWS Objects/clinic/unicodeobject.c.h Objects/unicodeobject.c description: Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug build. diff -r 603ac788ed27 -r 6af1a26e655f Misc/NEWS --- a/Misc/NEWS Tue Oct 25 09:43:48 2016 +0300 +++ b/Misc/NEWS Tue Oct 25 10:17:33 2016 +0300 @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug + build. + - Issue #28517: Fixed of-by-one error in the peephole optimizer that caused keeping unreachable code. diff -r 603ac788ed27 -r 6af1a26e655f Objects/unicodeobject.c --- a/Objects/unicodeobject.c Tue Oct 25 09:43:48 2016 +0300 +++ b/Objects/unicodeobject.c Tue Oct 25 10:17:33 2016 +0300 @@ -3236,24 +3236,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 *