diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2012-11-04 21:23:09 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2012-11-04 21:23:09 (GMT) |
commit | cfa9636404bb76cc98c5d5082457769c901b405f (patch) | |
tree | 623ba0564b7ab76ee6564ae039e12438b9e1dc3d /Objects/unicodeobject.c | |
parent | b716f84880fb719be417e9b49f8bb55bfd0106b8 (diff) | |
parent | f7ed5d111bbe30b36b2629a87d9fcc291de4aafb (diff) | |
download | cpython-cfa9636404bb76cc98c5d5082457769c901b405f.zip cpython-cfa9636404bb76cc98c5d5082457769c901b405f.tar.gz cpython-cfa9636404bb76cc98c5d5082457769c901b405f.tar.bz2 |
#8271: merge with 3.3.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 048361e..3b4bee2 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -4611,9 +4611,7 @@ PyUnicode_DecodeUTF8Stateful(const char *s, goto End; errmsg = "unexpected end of data"; startinpos = s - starts; - endinpos = startinpos + 1; - while (endinpos < size && (starts[endinpos] & 0xC0) == 0x80) - endinpos++; + endinpos = end - starts; break; case 1: errmsg = "invalid start byte"; @@ -4621,11 +4619,11 @@ PyUnicode_DecodeUTF8Stateful(const char *s, endinpos = startinpos + 1; break; case 2: + case 3: + case 4: errmsg = "invalid continuation byte"; startinpos = s - starts; - endinpos = startinpos + 1; - while (endinpos < size && (starts[endinpos] & 0xC0) == 0x80) - endinpos++; + endinpos = startinpos + ch - 1; break; default: if (unicode_putchar(&unicode, &outpos, ch) < 0) |