changeset: 105071:2cbd2ec6307d branch: 3.6 parent: 105064:72a2c90abdec parent: 105070:65b5518da6e2 user: Serhiy Storchaka date: Sat Nov 12 14:36:02 2016 +0200 files: Misc/NEWS Objects/clinic/unicodeobject.c.h Objects/unicodeobject.c description: Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X when decode astral characters. diff -r 72a2c90abdec -r 2cbd2ec6307d Misc/NEWS --- a/Misc/NEWS Fri Nov 11 15:57:09 2016 -0800 +++ b/Misc/NEWS Sat Nov 12 14:36:02 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 #19398: Extra slash no longer added to sys.path components in case of empty compile-time PYTHONPATH components. diff -r 72a2c90abdec -r 2cbd2ec6307d Objects/unicodeobject.c --- a/Objects/unicodeobject.c Fri Nov 11 15:57:09 2016 -0800 +++ b/Objects/unicodeobject.c Sat Nov 12 14:36:02 2016 +0200 @@ -5120,7 +5120,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);