mirror of
https://github.com/python/cpython.git
synced 2025-08-28 12:45:07 +00:00
Merged revisions 83395,83417 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k ........ r83395 | georg.brandl | 2010-08-01 10:49:18 +0200 (So, 01 Aug 2010) | 1 line #8821: do not rely on Unicode strings being terminated with a \u0000, rather explicitly check range before looking for a second surrogate character. ........ r83417 | georg.brandl | 2010-08-01 20:38:26 +0200 (So, 01 Aug 2010) | 1 line #5776: fix mistakes in python specfile. (Nobody probably uses it anyway.) ........
This commit is contained in:
parent
cea7e55998
commit
a70070c9e5
2 changed files with 6 additions and 7 deletions
|
@ -3597,7 +3597,7 @@ PyObject *PyUnicode_EncodeUnicodeEscape(const Py_UNICODE *s,
|
|||
|
||||
ch2 = *s++;
|
||||
size--;
|
||||
if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) {
|
||||
if (ch2 >= 0xDC00 && ch2 <= 0xDFFF && size) {
|
||||
ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 0x00010000;
|
||||
*p++ = '\\';
|
||||
*p++ = 'U';
|
||||
|
@ -3839,7 +3839,7 @@ PyObject *PyUnicode_EncodeRawUnicodeEscape(const Py_UNICODE *s,
|
|||
|
||||
ch2 = *s++;
|
||||
size--;
|
||||
if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) {
|
||||
if (ch2 >= 0xDC00 && ch2 <= 0xDFFF && size) {
|
||||
ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 0x00010000;
|
||||
*p++ = '\\';
|
||||
*p++ = 'U';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue