-
Notifications
You must be signed in to change notification settings - Fork 450
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
Performance issue with backtracking caused by some regexes #332
Comments
For me it's getting stuck at
My timing results when doubling the input user agent string length of a string of repeated letters:
|
Problem should be solved. Could you please do a retest with a version greater 0.6.0? |
How does replacing It doesn't. In both python and javascript the same REDoS performance problems still exist (confirm by trying the above examples). I assume it's because of the way |
Hi @bcaller, Could you please retest with latest version 0.6.3? Thanks. |
Hi! We are happy users of uap-core via https://github.com/ua-parser/uap-python, but we have recently noticed that some regexes may lead to excessive backtracking.
The regex that caused some issue for us is the following:
^(.*)/(\d+).?(\d+)?.?(\d+)?.?(\d+)? CFNetwork
A simple python script like the following hangs on my laptop for several minutes:
The main problem seems to be backtracking caused by the various blocks with .?, that doesn't happen if the regex is split into multiple ones for example:
The example that I brought up is of course a corner case, but even shorter strings with the same format can cause slow downs in parsing or hanging. It would be great to find a solution that is probably more verbose but that doesn't lead to these issues.
Thanks in advance!
Luca
The text was updated successfully, but these errors were encountered: