Skip to content

Commit b626643

Browse files
Issue python#28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X
when decode astral characters.
1 parent 07bcf05 commit b626643

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Misc/NEWS

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ What's New in Python 3.3.7?
1010
Core and Builtins
1111
-----------------
1212

13+
- Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X
14+
when decode astral characters. Patch by Xiang Zhang.
15+
1316
- Issue #26171: Fix possible integer overflow and heap corruption in
1417
zipimporter.get_data().
1518

Objects/unicodeobject.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -4896,7 +4896,7 @@ _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size)
48964896
#if SIZEOF_WCHAR_T == 4
48974897
assert(0);
48984898
#else
4899-
assert(Py_UNICODE_IS_SURROGATE(ch));
4899+
assert(ch > 0xFFFF && ch <= MAX_UNICODE);
49004900
/* compute and append the two surrogates: */
49014901
unicode[outpos++] = (wchar_t)Py_UNICODE_HIGH_SURROGATE(ch);
49024902
unicode[outpos++] = (wchar_t)Py_UNICODE_LOW_SURROGATE(ch);

0 commit comments

Comments
 (0)