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
Curl_fnmatch takes too long time on complicated pattern #2291
Comments
ping @monnerat, would you mind taking a look? You fixed it up recently, maybe you have a good idea on how this can be improved... |
I'm quite busy right now, but I'll do some profiling on it ASAP and report here. Your attached patch shows empty here... without patch, runtest.pl 1307 takes less than a second here. If not yet to be disclosed, you can send this patch to my perso e-mail :-) |
... works for me! |
Strange: can get it with curl, but FF does not show it :-( Now that I can see it, I have a straightforward explanation: this is a pathological case! I think I can develop a patch for this particular case, but we can think of other pathological cases, like IMHO, the only way to avoid them is to compile the pattern into a Deterministic Finite Automaton first, then apply this DFA to the string. The drawbacks are: bigger code, possible more time consumed in non-pathological cases and possible high memory needs depending on the pattern. By using such a DFA, backtracking is never needed. But maybe this is a bit "overthought" for such an insignifiant function ...? I'll submit a PR with a fix for the |
That's certainly not an understatement. The result of the fuzzer throwing crazy input at our APIs. |
I did not include your patch in a0984ea. I let you do it in case you want to refine it. |
Thanks, yes you did right. I'll see if I can brush it up a little and commit it separately. |
I did this
Run test case 1307 with the attached patch applied. This is OSS-fuzz issue 5908 (still not open to the public).
Patch: 0001-unit1307-add-test-that-takes-too-long-time-to-execut.patch
I expected the following
The test should execute swiftly and return error/success.
This happened
The execution of unit1307 takes many seconds. On my 3.5GHz machine, it takes more than 7 seconds. On slower hardware it can take much more time.
curl/libcurl version
Both 7.58.0 and git master work like this
operating system
OS agnostic.
The text was updated successfully, but these errors were encountered: