Issue41690
Created on 2020-09-02 10:59 by pablogsal, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 22053 | merged | pablogsal, 2020-09-02 10:59 | |
| PR 22067 | merged | pablogsal, 2020-09-02 16:52 | |
| Messages (3) | |||
|---|---|---|---|
| msg376225 - (view) | Author: Pablo Galindo Salgado (pablogsal) * | Date: 2020-09-02 10:59 | |
This program can segfault the parser by stackoverflow:
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 }] {
[...] }
Check https://github.com/we-like-parsers/pegen/issues/245 for more context and informaton
|
|||
| msg376255 - (view) | Author: Pablo Galindo Salgado (pablogsal) * | Date: 2020-09-02 16:44 | |
New changeset 4a97b1517a6b5ff22e2984b677a680b07ff0ce11 by Pablo Galindo in branch 'master': bpo-41690: Use a loop to collect args in the parser instead of recursion (GH-22053) https://github.com/python/cpython/commit/4a97b1517a6b5ff22e2984b677a680b07ff0ce11 |
|||
| msg376263 - (view) | Author: Pablo Galindo Salgado (pablogsal) * | Date: 2020-09-02 20:31 | |
New changeset 8de34cdb952a2e3b8d7a9a213845cad01a8cece3 by Pablo Galindo in branch '3.9': [3.9] bpo-41690: Use a loop to collect args in the parser instead of recursion (GH-22053) (GH-22067) https://github.com/python/cpython/commit/8de34cdb952a2e3b8d7a9a213845cad01a8cece3 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:35 | admin | set | github: 85856 |
| 2020-09-02 20:31:14 | pablogsal | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2020-09-02 20:31:07 | pablogsal | set | messages: + msg376263 |
| 2020-09-02 16:52:28 | pablogsal | set | pull_requests: + pull_request21157 |
| 2020-09-02 16:44:22 | pablogsal | set | messages: + msg376255 |
| 2020-09-02 10:59:35 | pablogsal | set | keywords:
+ patch stage: patch review pull_requests: + pull_request21153 |
| 2020-09-02 10:59:21 | pablogsal | create | |