summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-10-19 17:38:19 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-10-19 17:38:19 (GMT)
commit35804e4c63ae0a61adb71ced8ea6ddcf68908d41 (patch)
treeac9c542920e18a251f7df0175e6d4602771463f1 /Objects/unicodeobject.c
parent507c591e5bb9b850c9d996d8148cb669f1b5d62b (diff)
downloadcpython-35804e4c63ae0a61adb71ced8ea6ddcf68908d41.zip
cpython-35804e4c63ae0a61adb71ced8ea6ddcf68908d41.tar.gz
cpython-35804e4c63ae0a61adb71ced8ea6ddcf68908d41.tar.bz2
Issue #19279: UTF-7 decoder no more produces illegal strings.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 440d35a..a149177 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -4359,6 +4359,7 @@ PyUnicode_DecodeUTF7Stateful(const char *s,
Py_UCS4 outCh = (Py_UCS4)(base64buffer >> (base64bits-16));
base64bits -= 16;
base64buffer &= (1 << base64bits) - 1; /* clear high bits */
+ assert(outCh <= 0xffff);
if (surrogate) {
/* expecting a second surrogate */
if (Py_UNICODE_IS_LOW_SURROGATE(outCh)) {
@@ -4426,6 +4427,7 @@ PyUnicode_DecodeUTF7Stateful(const char *s,
inShift = 1;
shiftOutStart = outpos;
base64bits = 0;
+ base64buffer = 0;
}
}
else if (DECODE_DIRECT(ch)) { /* character decodes as itself */