changeset: 105069:bfd0da08438f branch: 3.4 parent: 104978:730cf8cdf02c parent: 105068:9bf1ca6ce1fe user: Serhiy Storchaka date: Sat Nov 12 14:29:48 2016 +0200 files: Misc/NEWS Objects/unicodeobject.c description: Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X when decode astral characters. diff -r 730cf8cdf02c -r bfd0da08438f Misc/NEWS --- a/Misc/NEWS Tue Nov 08 21:20:09 2016 +0200 +++ b/Misc/NEWS Sat Nov 12 14:29:48 2016 +0200 @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X + when decode astral characters. Patch by Xiang Zhang. + - Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug build. diff -r 730cf8cdf02c -r bfd0da08438f Objects/unicodeobject.c --- a/Objects/unicodeobject.c Tue Nov 08 21:20:09 2016 +0200 +++ b/Objects/unicodeobject.c Sat Nov 12 14:29:48 2016 +0200 @@ -4856,7 +4856,7 @@ #if SIZEOF_WCHAR_T == 4 assert(0); #else - assert(Py_UNICODE_IS_SURROGATE(ch)); + assert(ch > 0xFFFF && ch <= MAX_UNICODE); /* compute and append the two surrogates: */ unicode[outpos++] = (wchar_t)Py_UNICODE_HIGH_SURROGATE(ch); unicode[outpos++] = (wchar_t)Py_UNICODE_LOW_SURROGATE(ch);