Commit Graph

7 Commits

Author SHA1 Message Date
tidwall 4c9fc61b49 Add MatchLimit function for limiting pattern complexity
This commit adds the MatchLimit function, which it the
same as Match but will limit the complexity of the input pattern.
This is to avoid long running matches, specifically to avoid ReDos
attacks from arbritary inputs.

How it works:
The underlying match routine is recursive and may call itself when it
encounters a sandwiched wildcard pattern, such as: `user:*:name`.
Everytime it calls itself a counter is incremented.
The operation is stopped when counter > maxcomp*len(str).
2021-10-08 07:36:13 -07:00
tidwall 84b6aacbb9 Avoid expensive recursive operations 2021-10-04 11:40:34 -07:00
tidwall c2f534168b Fix slowness with repetitive stars 2020-12-23 04:58:28 -07:00
tidwall 9e52e9e068 fix comments 2020-11-03 10:51:01 -07:00
tidwall 33827db735 Added IsPattern func 2018-12-10 03:08:38 -07:00
Josh Baker 173748da73 allowable ranges 2016-08-30 10:39:30 -07:00
Josh Baker 970f69b4db first commit 2016-08-30 07:19:45 -07:00