google / google/google-sql-syntax-ts
Catastrophic backtracking issue in QueryFormatter
- Dominant language
- TypeScript
- Stars
- 10
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
There's a catastrophic backtracking regex issue that reproduces easily when there are too many newlines in the SQL file (as they match both the `\s` and `\n` in the `(\s|\n)+` and result in exponential backtracking).
Because of this, having too many consecutive newlines in any part of a SQL file results in never-ending formatting.
Reproduction and fix is in #6.
Contributor guide
Research direction
Start by locating QueryFormatter and the `(\s|\n)+` expression described in the issue. Review the reproduction and fix referenced in issue #6, then verify that SQL containing many consecutive newlines formats promptly without catastrophic backtracking.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100