summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-08-01 18:59:44 (GMT)
committerGeorg Brandl <georg@python.org>2010-08-01 18:59:44 (GMT)
commita70070c9e5a45aaa72278143331292dd17c0342e (patch)
tree02cf71bfaf72dcb1395d743df6c7aabf02a795b2 /Objects/unicodeobject.c
parentcea7e55998d9e3c24c74fa55e59b252ac592d95e (diff)
downloadcpython-a70070c9e5a45aaa72278143331292dd17c0342e.zip
cpython-a70070c9e5a45aaa72278143331292dd17c0342e.tar.gz
cpython-a70070c9e5a45aaa72278143331292dd17c0342e.tar.bz2
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.) ........
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 199f34a..a18c571 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -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';