summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-10-19 17:37:49 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-10-19 17:37:49 (GMT)
commitf10567233237673e8b96aff8a9753a6426fa4474 (patch)
treeab3f498abfd5de6c0396f45765f0b9d02773ec20 /Objects/unicodeobject.c
parent6ea3c9b22a3e81e6484a30c1d64c6a859a40da6a (diff)
downloadcpython-f10567233237673e8b96aff8a9753a6426fa4474.zip
cpython-f10567233237673e8b96aff8a9753a6426fa4474.tar.gz
cpython-f10567233237673e8b96aff8a9753a6426fa4474.tar.bz2
Issue #19279: UTF-7 decoder no more produces illegal unicode 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 866eb9b..5ce9c88 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 */