Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regular expression causes exponential backtracking on Lua #38

Closed
aldy505 opened this issue Oct 2, 2021 · 0 comments · Fixed by #60
Closed

Regular expression causes exponential backtracking on Lua #38

aldy505 opened this issue Oct 2, 2021 · 0 comments · Fixed by #60
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@aldy505
Copy link
Member

aldy505 commented Oct 2, 2021

  1. This part of the regular expression may cause exponential backtracking on strings starting with '{!,' and containing many repetitions of '!,'.

    { pattern: /{\s*(\S+)((,|;)\s*\S+)*\s*}/, type: 'constant.array' },

  2. This part of the regular expression may cause exponential backtracking on strings starting with '{!=!,' and containing many repetitions of '!=!,'.

    { pattern: /{\s*(\S+\s*=\s*\S+)((,|;)\s*\S+\s*=\s*\S+)*\s*}/, type: 'constant.dictionary' },

According to the LGTM rule (click that link to see detailed rule):

Some regular expressions take a long time to match certain input strings to the point where the time it takes to match a string of length n is proportional to nk or even 2n. Such regular expressions can negatively affect performance, or even allow a malicious user to perform a Denial of Service ("DoS") attack by crafting an expensive input string for the regular expression to match.

See LGTM for the detailed issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant