summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-10-19 17:39:28 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-10-19 17:39:28 (GMT)
commit55e092f545d3829e94eaf3d6aaaf048c82451e18 (patch)
tree6e7404db19ef4f111befb5cbff67c9403969233f /Objects/unicodeobject.c
parentf19a6ef2c9e87f7a5429b2fcf0705265bdeb8b34 (diff)
parent35804e4c63ae0a61adb71ced8ea6ddcf68908d41 (diff)
downloadcpython-55e092f545d3829e94eaf3d6aaaf048c82451e18.zip
cpython-55e092f545d3829e94eaf3d6aaaf048c82451e18.tar.gz
cpython-55e092f545d3829e94eaf3d6aaaf048c82451e18.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 5df4df6..b9e8e1e 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -4341,6 +4341,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)) {
@@ -4408,6 +4409,7 @@ PyUnicode_DecodeUTF7Stateful(const char *s,
inShift = 1;
shiftOutStart = writer.pos;
base64bits = 0;
+ base64buffer = 0;
}
}
else if (DECODE_DIRECT(ch)) { /* character decodes as itself */