diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-08 21:41:55 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-08 21:41:55 (GMT) |
commit | 24a3ef699944fa0d816f78b2da1ef32fe4d1e453 (patch) | |
tree | 89ed22d32a9be82409136edb672cf80347898360 /Objects | |
parent | dbfc80851a72e6921eed0b86b8e97b5989c23cc6 (diff) | |
parent | ae3b32ad6bd6326e14b4b4316af6edea8dfc9173 (diff) | |
download | cpython-24a3ef699944fa0d816f78b2da1ef32fe4d1e453.zip cpython-24a3ef699944fa0d816f78b2da1ef32fe4d1e453.tar.gz cpython-24a3ef699944fa0d816f78b2da1ef32fe4d1e453.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')
-rw-r--r-- | Objects/unicodeobject.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index c9185bd..41c3549 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -5159,8 +5159,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: |