mirror of
https://github.com/python/cpython.git
synced 2025-08-27 12:16:04 +00:00
bpo-22602: Raise an exception in the UTF-7 decoder for ill-formed sequences starting with "+". (GH-8741)
The UTF-7 decoder now raises UnicodeDecodeError for ill-formed sequences starting with "+" (as specified in RFC 2152).
This commit is contained in:
parent
d3d3171da8
commit
e349bf2358
4 changed files with 13 additions and 0 deletions
|
@ -4479,6 +4479,11 @@ PyUnicode_DecodeUTF7Stateful(const char *s,
|
|||
if (_PyUnicodeWriter_WriteCharInline(&writer, '+') < 0)
|
||||
goto onError;
|
||||
}
|
||||
else if (s < e && !IS_BASE64(*s)) {
|
||||
s++;
|
||||
errmsg = "ill-formed sequence";
|
||||
goto utf7Error;
|
||||
}
|
||||
else { /* begin base64-encoded section */
|
||||
inShift = 1;
|
||||
surrogate = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue