summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-11-12 12:28:06 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-11-12 12:28:06 (GMT)
commitb626643734dfd80780a1d301d4a96e57052aa262 (patch)
tree0ad8c5998fd378b8be147d3bc93b80f73449cb6d
parent07bcf05fcf3fd1d4001e8e3489162e6d67638285 (diff)
downloadcpython-b626643734dfd80780a1d301d4a96e57052aa262.zip
cpython-b626643734dfd80780a1d301d4a96e57052aa262.tar.gz
cpython-b626643734dfd80780a1d301d4a96e57052aa262.tar.bz2
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 c55dc4a..d3489d1 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@ What's New in Python 3.3.7?
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 #26171: Fix possible integer overflow and heap corruption in
zipimporter.get_data().
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index cf4f842..24eda6b 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -4896,7 +4896,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);