[Python-checkins] r83418 - in python/branches/release27-maint: Objects/unicodeobject.c
georg.brandl
python-checkins at python.org
Sun Aug 1 20:41:59 CEST 2010
Author: georg.brandl
Date: Sun Aug 1 20:41:59 2010
New Revision: 83418
Log:
Merged revisions 83395 via svnmerge from
svn+ssh://pythondev@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.
........
Modified:
python/branches/release27-maint/ (props changed)
python/branches/release27-maint/Objects/unicodeobject.c
Modified: python/branches/release27-maint/Objects/unicodeobject.c
==============================================================================
--- python/branches/release27-maint/Objects/unicodeobject.c (original)
+++ python/branches/release27-maint/Objects/unicodeobject.c Sun Aug 1 20:41:59 2010
@@ -3067,7 +3067,7 @@
ch2 = *s++;
size--;
- if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) {
+ if (ch2 >= 0xDC00 && ch2 <= 0xDFFF && size) {
ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 0x00010000;
*p++ = '\\';
*p++ = 'U';
@@ -3316,7 +3316,7 @@
ch2 = *s++;
size--;
- if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) {
+ if (ch2 >= 0xDC00 && ch2 <= 0xDFFF && size) {
ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 0x00010000;
*p++ = '\\';
*p++ = 'U';
More information about the Python-checkins
mailing list