diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-03-30 06:52:41 -0700 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2019-03-30 15:52:41 +0200 |
commit | bd48280cb66544827952ca91e326cbb178c8c461 (patch) | |
tree | 311677f37b61b17296375feaf118361ea78f0fc2 /Objects | |
parent | 4724ba9b57c45ce4bca3c828f2ed8dcff3800a0c (diff) | |
download | cpython-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.c | 3 |
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; |