Skip to content

AI spam#2182

Closed
goingforstudying-ctrl wants to merge 3 commits into
pallets:mainfrom
goingforstudying-ctrl:fix/string-regex-backtracking
Closed

AI spam#2182
goingforstudying-ctrl wants to merge 3 commits into
pallets:mainfrom
goingforstudying-ctrl:fix/string-regex-backtracking

Conversation

@goingforstudying-ctrl

Copy link
Copy Markdown

Fixes #2109

The string_re regular expression caused catastrophic backtracking on unclosed strings with many escape sequences. Replace it with a manual scanner that uses str.find to locate closing quotes and verifies they are not escaped, eliminating exponential backtracking.

goingforstudying-ctrl and others added 3 commits June 6, 2026 06:56
The string_re regular expression caused catastrophic backtracking
on unclosed strings with many escape sequences. Replace it with a
manual scanner that uses str.find to locate closing quotes and
verifies they are not escaped, eliminating exponential backtracking.

Fixes pallets#2109
@davidism davidism closed this Jun 6, 2026
@davidism davidism changed the title fix(lexer): replace string regex with linear scanner AI spam Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

poor performance when parsing unclosed string with many escape characters

2 participants