google / google/google-sql-syntax-ts

Catastrophic backtracking issue in QueryFormatter

未关闭
#7 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
10
派生
4
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

打开贡献指南

调研方向

首先定位 QueryFormatter 和 issue 中描述的 `(\s|\n)+` 表达式。查看 issue #6 中引用的复现和修复,然后验证包含大量连续换行符的 SQL 能够快速完成格式化,而不会发生灾难性回溯。

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
performance
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。