pest-parser / pest-parser/pest
Timeout in recursion
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.4k
- Forks
- 307
- Avg merge
- 8h 23m
- Merged PRs (30d)
- 5
Description
Found while fuzzing Tera v1.
The following expression is very slow: https://github.com/Keats/tera/blob/v1/src/tera.rs#L1028
and adding a level of recursion (eg _(p=__(p=[_(p=__(p=[_(p=[_(p=[_1(p=[_(p=[_1) will timeout
As far as I can see, the issue is that the rule fn_call is in the basic_val (https://github.com/Keats/tera/blob/v1/src/parser/tera.pest#L82) which is part of the potential values for a function argument -> recursing.
The issue seem to be in the generated lexer since it timeouts in the pest generated code.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the timeout from Tera v1 at src/tera.rs#L1028 using the recursive expression in the issue. Read the fn_call rule in src/parser/tera.pest#L82 and inspect the generated lexer code to trace the recursion. Done means the expression no longer times out.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100