Commit Graph

2 Commits

Author SHA1 Message Date
apk e0d129e129 fix(tokenizer): prevent ReDoS hang in lisp string regex (#737)
Replace the nested-quantifier string pattern /"(?:[^"\\]*|\\.)*"/
with /"(?:[^"\\]|\\[\s\S])*"/ in the Lisp/Elisp grammar.

The original pattern could catastrophically backtrack (O(2^n)) when a
string contained a backslash-newline line continuation, because JS dot
does not match newlines, leaving both alternatives unable to advance.
The fixed pattern eliminates nested quantifiers and uses [\s\S] so
line continuations are consumed correctly.

Adds a regression test with a 5s timeout guard and populates the
previously-empty fixtures/commonlisp/*.el fixture files with realistic
Elisp code that includes the backslash-newline pattern.
2026-05-14 07:08:01 +02:00
Andrey Kucherenko 633a854335 refactor: 💡 add new branch to git repo 2020-04-29 19:14:00 +03:00