cpython/Parser
Serhiy Storchaka 73b3040f59
[3.11] gh-133767: Fix use-after-free in the unicode-escape decoder with an error handler (GH-129648) (GH-133944) (GH-134341)
If the error handler is used, a new bytes object is created to set as
the object attribute of UnicodeDecodeError, and that bytes object then
replaces the original data. A pointer to the decoded data will became invalid
after destroying that temporary bytes object. So we need other way to return
the first invalid escape from _PyUnicode_DecodeUnicodeEscapeInternal().

_PyBytes_DecodeEscape() does not have such issue, because it does not
use the error handlers registry, but it should be changed for compatibility
with _PyUnicode_DecodeUnicodeEscapeInternal().
(cherry picked from commit 9f69a58623)
(cherry picked from commit 6279eb8c07)
(cherry picked from commit a75953b347)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-02 17:52:52 +02:00
..
action_helpers.c
asdl.py
asdl_c.py
myreadline.c
parser.c [3.11] gh-109120: Fix syntax error in handlinh of incorrect star expressions… (#117464) 2024-04-03 11:37:39 +01:00
peg_api.c
pegen.c
pegen.h
pegen_errors.c [3.11] gh-115823: Calculate correctly error locations when dealing with implicit encodings (GH-115824) (#115950) 2024-02-26 16:08:37 +00:00
Python.asdl
string_parser.c [3.11] gh-133767: Fix use-after-free in the unicode-escape decoder with an error handler (GH-129648) (GH-133944) (GH-134341) 2025-06-02 17:52:52 +02:00
string_parser.h
token.c
tokenizer.c
tokenizer.h