diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-10-19 20:37:49 +0300 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-10-19 20:37:49 +0300 |
commit | 0cbf41f68516f5a5fe6e3fb0d7afc2fa8a6ea357 (patch) | |
tree | 22a2b7390798f7fad508a60f17fe365c879b0819 /Objects | |
parent | f995cf66e6691f5f2d7ab6252d737771df9ddd49 (diff) | |
download | cpython-0cbf41f68516f5a5fe6e3fb0d7afc2fa8a6ea357.tar.gz |
Issue #19279: UTF-7 decoder no more produces illegal unicode strings.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/unicodeobject.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 866eb9b058..5ce9c88efa 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -1671,6 +1671,7 @@ PyObject *PyUnicode_DecodeUTF7Stateful(const char *s, (base64buffer >> (base64bits-16)); base64bits -= 16; base64buffer &= (1 << base64bits) - 1; /* clear high bits */ + assert(outCh <= 0xffff); if (surrogate) { /* expecting a second surrogate */ if (outCh >= 0xDC00 && outCh <= 0xDFFF) { @@ -1737,6 +1738,7 @@ PyObject *PyUnicode_DecodeUTF7Stateful(const char *s, inShift = 1; shiftOutStart = p; base64bits = 0; + base64buffer = 0; } } else if (DECODE_DIRECT(ch)) { /* character decodes as itself */ |