summaryrefslogtreecommitdiff
path: root/Objects
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-03-30 06:52:41 -0700
committerSerhiy Storchaka <storchaka@gmail.com>2019-03-30 15:52:41 +0200
commitbd48280cb66544827952ca91e326cbb178c8c461 (patch)
tree311677f37b61b17296375feaf118361ea78f0fc2 /Objects
parent4724ba9b57c45ce4bca3c828f2ed8dcff3800a0c (diff)
downloadcpython-git-bd48280cb66544827952ca91e326cbb178c8c461.tar.gz
bpo-24214: Fixed the UTF-8 incremental decoder. (GH-12603) (GH-12627)
The bug occurred when the encoded surrogate character is passed to the incremental decoder in two chunks. (cherry picked from commit 7a465cb5ee7e298cae626ace1fc3e7d97df79f2e) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index adcf69d4e5..e18937981b 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -4890,6 +4890,9 @@ PyUnicode_DecodeUTF8Stateful(const char *s,
case 2:
case 3:
case 4:
+ if (s == end || consumed) {
+ goto End;
+ }
errmsg = "invalid continuation byte";
startinpos = s - starts;
endinpos = startinpos + ch - 1;