mirror of
https://github.com/python/cpython.git
synced 2026-03-24 13:40:57 +00:00
This program can segfault the parser by stack overflow:
```
import ast
code = "f(" + ",".join(['a' for _ in range(100000)]) + ")"
print("Ready!")
ast.parse(code)
```
the reason is that the rule for arguments has a simple recursion when collecting args:
args[expr_ty]:
[...]
| a=named_expression b=[',' c=args { c }] {
[...] }
|
||
|---|---|---|
| .. | ||
| python.gram | ||
| Tokens | ||