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

Skip to content

Commit 6b4b6e9

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

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 @@ Release date: TBA
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
@@ -4816,7 +4816,7 @@ _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size)
48164816
#if SIZEOF_WCHAR_T == 4
48174817
assert(0);
48184818
#else
4819-
assert(Py_UNICODE_IS_SURROGATE(ch));
4819+
assert(ch > 0xFFFF && ch <= MAX_UNICODE);
48204820
/* compute and append the two surrogates: */
48214821
unicode[outpos++] = (wchar_t)Py_UNICODE_HIGH_SURROGATE(ch);
48224822
unicode[outpos++] = (wchar_t)Py_UNICODE_LOW_SURROGATE(ch);

0 commit comments

Comments
 (0)