diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-12 12:29:48 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-12 12:29:48 (GMT) |
commit | 84293aff9fec20cb903bf1242c28404c671c56d1 (patch) | |
tree | f62760b60473407299c39926a440865fb2349203 | |
parent | 1c3fdd900d102cf993fb787dfc65fb01d987945d (diff) | |
parent | b626643734dfd80780a1d301d4a96e57052aa262 (diff) | |
download | cpython-84293aff9fec20cb903bf1242c28404c671c56d1.zip cpython-84293aff9fec20cb903bf1242c28404c671c56d1.tar.gz cpython-84293aff9fec20cb903bf1242c28404c671c56d1.tar.bz2 |
Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X
when decode astral characters.
-rw-r--r-- | Misc/NEWS | 3 | ||||
-rw-r--r-- | Objects/unicodeobject.c | 2 |
2 files changed, 4 insertions, 1 deletions
@@ -10,6 +10,9 @@ Release date: TBA 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 --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 7fad695..ee6eac3 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -4856,7 +4856,7 @@ _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size) #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); |