summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2019-03-30 06:23:38 (GMT)
committerGitHub <noreply@github.com>2019-03-30 06:23:38 (GMT)
commit7a465cb5ee7e298cae626ace1fc3e7d97df79f2e (patch)
tree82c7fc3122ba18119b236bbdfa7a1e55fe196108 /Objects
parent38f4e468d4b55551e135c67337c18ae142193ba8 (diff)
downloadcpython-7a465cb5ee7e298cae626ace1fc3e7d97df79f2e.zip
cpython-7a465cb5ee7e298cae626ace1fc3e7d97df79f2e.tar.gz
cpython-7a465cb5ee7e298cae626ace1fc3e7d97df79f2e.tar.bz2
bpo-24214: Fixed the UTF-8 incremental decoder. (GH-12603)
The bug occurred when the encoded surrogate character is passed to the incremental decoder in two chunks.
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 8ab3943..c0b345b 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -4883,6 +4883,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;