summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-11-12 14:36:02 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2016-11-12 14:36:02 +0200
commitbabe4f8e5ede1f9a6f4206b97c303c8d33346b3b (patch)
treeb03b28f2949c53937c2a9d6f97c09f8143c2a776
parent2d6c17936e426fd1417494fc5f0dcce548aad885 (diff)
parent6b4b6e956eaaff272fa4ffe0221a9cc8ef07882f (diff)
downloadcpython-git-babe4f8e5ede1f9a6f4206b97c303c8d33346b3b.tar.gz
Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X
when decode astral characters.
-rw-r--r--Misc/NEWS3
-rw-r--r--Objects/unicodeobject.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 24810f0560..73247ee2f2 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@ What's New in Python 3.6.0 beta 4
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 --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 249cf578d9..7c383628a6 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -5120,7 +5120,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);