gh-99612: Fix PyUnicode_DecodeUTF8Stateful() for ASCII-only data (GH-99613)

Previously *consumed was not set in this case.
This commit is contained in:
Serhiy Storchaka 2022-12-01 14:54:51 +02:00 committed by GitHub
parent d460c8ec52
commit f08e52ccb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 95 additions and 0 deletions

View file

@ -4530,6 +4530,9 @@ unicode_decode_utf8(const char *s, Py_ssize_t size,
}
s += ascii_decode(s, end, PyUnicode_1BYTE_DATA(u));
if (s == end) {
if (consumed) {
*consumed = size;
}
return u;
}