google / google/google-sql-syntax-ts

Catastrophic backtracking issue in QueryFormatter

Offen
#7 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
10
Forks
4
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
performance
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.