git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] wildmatch: fix exponential behavior
@ 2023-03-20 16:09 Phillip Wood
  2023-03-20 16:10 ` [PATCH 1/3] " Phillip Wood
                   ` (4 more replies)
  0 siblings, 5 replies; 22+ messages in thread
From: Phillip Wood @ 2023-03-20 16:09 UTC (permalink / raw)
  To: git; +Cc: Derrick Stolee, Jeff King, Phillip Wood

From: Phillip Wood <phillip.wood@dunelm.org.uk>

The wildmatch implementation in git suffers from exponential behavior as
described in [1] where the time taken for a failing match is exponential
in the number of wildcards it contains. The original implementation
imported from rsync is immune but the optimizations introduced by [2.3]
failed to prevent unnecessary backtracking when handling '*' and '/**/'.

This bug was were discussed on the security list and the conclusion was
that it only affects operations that are already potential DoS vectors.

In the long term it would be nice to get rid of the recursion in the
wildmatch() code but the patches here focus on a minimal fix.

This series is based on maint. Unfortunately it conflicts with
my/wildmatch-cleanups when merged with seen. There are sematic
conflicts with the removal of dowild() in  e303cf8092 (wildmatch:
more cleanups after killing uchar, 2023-02-26) as well as textual
conflicts around the change of uchar->char.

[1] https://research.swtch.com/glob
[2] 6f1a31f0aa (wildmatch: advance faster in <asterisk> + <literal> patterns, 2013-01-01)
[3] 46983441ae (wildmatch: make a special case for "*/" with FNM_PATHNAME, 2013-01-01)

Published-As: https://github.com/phillipwood/git/releases/tag/wildmatch-fixes%2Fv1
View-Changes-At: https://github.com/phillipwood/git/compare/73876f486...a74ab7138
Fetch-It-Via: git fetch https://github.com/phillipwood/git wildmatch-fixes/v1

Phillip Wood (3):
  wildmatch: fix exponential behavior
  wildmatch: avoid undefined behavior
  wildmatch: hide internal return values

 t/t3070-wildmatch.sh |  9 +++++++++
 wildmatch.c          | 23 ++++++++++++++++-------
 wildmatch.h          |  2 --
 3 files changed, 25 insertions(+), 9 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2023-03-26 14:55 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-20 16:09 [PATCH 0/3] wildmatch: fix exponential behavior Phillip Wood
2023-03-20 16:10 ` [PATCH 1/3] " Phillip Wood
2023-03-24 22:17   ` [PATCH] t3070: make chain lint tester happy Michael J Gruber
2023-03-25  6:37     ` Jeff King
2023-03-25  6:54       ` Eric Sunshine
2023-03-25  7:58         ` Jeff King
2023-03-25  8:04           ` Jeff King
2023-03-25  8:18             ` Eric Sunshine
2023-03-25  8:41               ` Jeff King
2023-03-25  8:51                 ` Jeff King
2023-03-25  9:09                   ` Eric Sunshine
2023-03-25 19:47                     ` Jeff King
2023-03-25  9:17                 ` Eric Sunshine
2023-03-26 14:30             ` Phillip Wood
2023-03-26 14:54               ` Michael J Gruber
2023-03-25  8:06           ` Eric Sunshine
2023-03-25  8:36             ` Jeff King
2023-03-20 16:10 ` [PATCH 2/3] wildmatch: avoid undefined behavior Phillip Wood
2023-03-20 16:10 ` [PATCH 3/3] wildmatch: hide internal return values Phillip Wood
2023-03-20 17:58 ` [PATCH 0/3] wildmatch: fix exponential behavior Junio C Hamano
2023-03-23 14:19 ` Derrick Stolee
2023-03-24 14:04   ` Phillip Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).