Stack overflow when parsing an expression
Open
- Dominant language
- Python
- Stars
- 1.9k
- Forks
- 229
- PR merge metrics
- No merged PRs in 30d
Description
Below I've attached a real file that has been published on PyPI. It contains an impressively gigantic expression.
[huge.txt](https://github.com/Instagram/LibCST/files/12445264/huge.txt)
Parsing this file with the current libcst master branch causes a stack overflow. After some debugging, this appears to be caused by the `cache_left_rec` macro cloning the expression ([here](https://github.com/kevinmehall/rust-peg/blob/c870876adc9a9601f14dfa3e13c5a691ddfeb8ee/peg-macros/translate.rs#L292-L294)), which in this case causes a _gigantic_ recursive clone of the expression, eventually overflowing the stack.
Contributor guide
Assessment
This issue has not been assessed yet.