Skip to content

Commit e7c18f0

Browse files
committed
fix: simplify regex to avoid ReDoS vulnerability
1 parent a2a6bc9 commit e7c18f0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/treemapper/diffctx/fragments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ def _find_section_end(self, lines: list[str], start_line: int, level: int, remai
694694

695695
class RegexMarkdownStrategy:
696696
priority = 85
697-
_HEADING_RE = re.compile(r"^(#{1,6})\s+([^\n]+)$", re.MULTILINE)
697+
_HEADING_RE = re.compile(r"^(#{1,6}) (.+)$")
698698

699699
def can_handle(self, path: Path, content: str) -> bool:
700700
return path.suffix.lower() in {".md", ".markdown", ".mdx"}

0 commit comments

Comments
 (0)