]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-11105: Do not crash when compiling recursive ASTs (GH-20594)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 3 Jun 2021 20:27:00 +0000 (13:27 -0700)
committerGitHub <noreply@github.com>
Thu, 3 Jun 2021 20:27:00 +0000 (13:27 -0700)
commit976598d36bd180024c5f0edf1f7ec0f0b436380f
tree8ae5dfe69ec4144d862ff1ea53557b10b0b474fe
parentd2ab15f5376aa06ed120164f1b84bb40adbdd068
bpo-11105: Do not crash when compiling recursive ASTs (GH-20594)

When compiling an AST object with a direct / indirect reference
cycles, on the conversion phase because of exceeding amount of
calls, a segfault was raised. This patch adds recursion guards to
places for preventing user inputs to not to crash AST but instead
raise a RecursionError.
(cherry picked from commit f3491242e41933aa9529add7102edb68b80a25e9)

Co-authored-by: Batuhan Taskaya <batuhan@python.org>
Lib/test/test_ast.py
Misc/NEWS.d/next/Core and Builtins/2020-06-02-13-21-14.bpo-11105.wceryW.rst [new file with mode: 0644]
Parser/asdl_c.py
Python/Python-ast.c