[Python-checkins] cpython (3.3): Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X

serhiy.storchaka python-checkins at python.org
Sat Nov 12 07:37:36 EST 2016


https://hg.python.org/cpython/rev/9bf1ca6ce1fe
changeset:   105068:9bf1ca6ce1fe
branch:      3.3
parent:      104977:7e66c5dc4218
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Sat Nov 12 14:28:06 2016 +0200
summary:
  Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X
when decode astral characters.

files:
  Misc/NEWS               |  3 +++
  Objects/unicodeobject.c |  2 +-
  2 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -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 #26171: Fix possible integer overflow and heap corruption in
   zipimporter.get_data().
 
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -4896,7 +4896,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);

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list