mirror of
https://github.com/python/cpython.git
synced 2025-09-25 01:43:11 +00:00
Issue #14579: Fix error handling bug in the utf-16 decoder.
Patch by Serhiy Storchaka.
This commit is contained in:
parent
bee739baa7
commit
715a63b783
3 changed files with 30 additions and 3 deletions
|
@ -2564,7 +2564,7 @@ PyUnicode_DecodeUTF16Stateful(const char *s,
|
|||
}
|
||||
|
||||
/* UTF-16 code pair: */
|
||||
if (q >= e) {
|
||||
if (e - q < 2) {
|
||||
errmsg = "unexpected end of data";
|
||||
startinpos = (((const char *)q)-2)-starts;
|
||||
endinpos = ((const char *)e)-starts;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue