Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit babe4f8

Browse files
Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X
when decode astral characters.
2 parents 2d6c179 + 6b4b6e9 commit babe4f8

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ What's New in Python 3.6.0 beta 4
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 #19398: Extra slash no longer added to sys.path components in case of
1417
empty compile-time PYTHONPATH components.
1518

Objects/unicodeobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5120,7 +5120,7 @@ _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size)
51205120
#if SIZEOF_WCHAR_T == 4
51215121
assert(0);
51225122
#else
5123-
assert(Py_UNICODE_IS_SURROGATE(ch));
5123+
assert(ch > 0xFFFF && ch <= MAX_UNICODE);
51245124
/* compute and append the two surrogates: */
51255125
unicode[outpos++] = (wchar_t)Py_UNICODE_HIGH_SURROGATE(ch);
51265126
unicode[outpos++] = (wchar_t)Py_UNICODE_LOW_SURROGATE(ch);

0 commit comments

Comments
 (0)