Skip to content

Commit 4d5693b

Browse files
peffgitster
authored andcommitted
lower core.maxTreeDepth default to 2048
On my Linux system, all of our recursive tree walking algorithms can run up to the 4096 default limit without segfaulting. But not all platforms will have stack sizes as generous (nor might even Linux if we kick off a recursive walk within a thread). In particular, several of the tests added in the previous few commits fail in our Windows CI environment. Through some guess-and-check pushing, I found that 3072 is still too much, but 2048 is OK. These are obviously vague heuristics, and there is nothing to promise that another system might not have trouble at even lower values. But it seems unlikely anybody will be too angry about a 2048-depth limit (this is close to the default max-pathname limit on Linux even for a pathological path like "a/a/a/..."). So let's just lower it. Some alternatives are: - configure separate defaults for Windows versus other platforms. - just skip the tests on Windows. This leaves Windows users with the annoying case that they can be crashed by running out of stack space, but there shouldn't be any security implications (they can't go deep enough to hit integer overflow problems). Since the original default was arbitrary, it seems less confusing to just lower it, keeping behavior consistent across platforms. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7b61bd1 commit 4d5693b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

environment.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ int merge_log_config = -1;
8181
int precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */
8282
unsigned long pack_size_limit_cfg;
8383
enum log_refs_config log_all_ref_updates = LOG_REFS_UNSET;
84-
int max_allowed_tree_depth = 4096;
84+
int max_allowed_tree_depth = 2048;
8585

8686
#ifndef PROTECT_HFS_DEFAULT
8787
#define PROTECT_HFS_DEFAULT 0

0 commit comments

Comments
 (0)