summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-01-08 21:40:52 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-01-08 21:40:52 (GMT)
commitae3b32ad6bd6326e14b4b4316af6edea8dfc9173 (patch)
tree6fb22559c8b1d83e2d2f9051a982b660613541f5 /Objects/unicodeobject.c
parent040c3c81c1d2fafe4bec9bec9e1e448c84ae7dd8 (diff)
parent48e188e57313813bd048e25b8fa6123b8cd5c9a0 (diff)
downloadcpython-ae3b32ad6bd6326e14b4b4316af6edea8dfc9173.zip
cpython-ae3b32ad6bd6326e14b4b4316af6edea8dfc9173.tar.gz
cpython-ae3b32ad6bd6326e14b4b4316af6edea8dfc9173.tar.bz2
Issue #11461: Fix the incremental UTF-16 decoder. Original patch by
Amaury Forgeot d'Arc. Added tests for partial decoding of non-BMP characters.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 1522a16..b4fc004 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -5284,8 +5284,11 @@ PyUnicode_DecodeUTF16Stateful(const char *s,
/* The remaining input chars are ignored if the callback
chooses to skip the input */
case 1:
+ q -= 2;
+ if (consumed)
+ goto End;
errmsg = "unexpected end of data";
- startinpos = ((const char *)q) - 2 - starts;
+ startinpos = ((const char *)q) - starts;
endinpos = ((const char *)e) - starts;
break;
case 2: