cpython/Parser
Serhiy Storchaka ab9893c406
[3.10] gh-133767: Fix use-after-free in the unicode-escape decoder with an error handler (GH-129648) (GH-133944) (GH-134345)
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)
(cherry picked from commit 0c33e5baed)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2025-06-02 17:55:48 +02:00
..
Python.asdl bpo-46289: Make conversion of FormattedValue not optional on ASDL (GH-30467) 2022-01-07 14:30:18 -08:00
asdl.py bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25142) 2021-04-02 12:53:46 +09:00
asdl_c.py bpo-11105: Do not crash when compiling recursive ASTs (GH-20594) 2021-06-03 13:27:00 -07:00
myreadline.c bpo-30555: Fix WindowsConsoleIO fails in the presence of fd redirection (GH-1927) 2021-04-23 23:00:27 +01:00
parser.c [3.10] gh-102416: Do not memoize incorrectly loop rules in the parser (GH-102467). (#102474) 2023-03-06 16:59:16 +00:00
peg_api.c bpo-43244: Remove parser_interface.h header file (GH-25001) 2021-03-24 01:29:09 +01:00
pegen.c [3.10] GH-102711: Fix warnings found by clang (GH-102712) (#103076) 2023-03-28 11:27:41 +02:00
pegen.h [3.10] Backport bpo-47212 (GH-32302) to Python 3.10 (GH-32334) 2022-04-05 09:21:49 -07:00
string_parser.c [3.10] gh-133767: Fix use-after-free in the unicode-escape decoder with an error handler (GH-129648) (GH-133944) (GH-134345) 2025-06-02 17:55:48 +02:00
string_parser.h bpo-43244: Remove ast.h, asdl.h, Python-ast.h headers (GH-24933) 2021-03-23 20:47:40 +01:00
token.c bpo-43822: Improve syntax errors for missing commas (GH-25377) 2021-04-15 21:38:45 +01:00
tokenizer.c [3.10] gh-99581: Fix a buffer overflow in the tokenizer when copying lines that fill the available buffer (GH-99605). (#99630) 2022-11-20 22:30:15 +00:00
tokenizer.h [3.10] Ensure the str member of the tokenizer is always initialised (GH-29681). (GH-29683) 2021-11-21 04:15:22 +00:00