diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-01-10 20:52:49 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-01-10 20:52:49 +0100 |
commit | 09481fec21f339d980fca369be3936964003d38b (patch) | |
tree | 744caf847eb0c3da06a9bd80132c95882e3c57f4 /dir.c | |
parent | The seventh batch (diff) | |
parent | sparse-checkout: refuse to add to bad patterns (diff) | |
download | git-09481fec21f339d980fca369be3936964003d38b.tar.xz git-09481fec21f339d980fca369be3936964003d38b.zip |
Merge branch 'ds/sparse-checkout-malformed-pattern-fix'
Certain sparse-checkout patterns that are valid in non-cone mode
led to segfault in cone mode, which has been corrected.
* ds/sparse-checkout-malformed-pattern-fix:
sparse-checkout: refuse to add to bad patterns
sparse-checkout: fix OOM error with mixed patterns
sparse-checkout: fix segfault on malformed patterns
Diffstat (limited to 'dir.c')
-rw-r--r-- | dir.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -727,7 +727,7 @@ static void add_pattern_to_hashsets(struct pattern_list *pl, struct path_pattern } if (given->patternlen < 2 || - *given->pattern == '*' || + *given->pattern != '/' || strstr(given->pattern, "**")) { /* Not a cone pattern. */ warning(_("unrecognized pattern: '%s'"), given->pattern); @@ -819,9 +819,7 @@ static void add_pattern_to_hashsets(struct pattern_list *pl, struct path_pattern /* we already included this at the parent level */ warning(_("your sparse-checkout file may have issues: pattern '%s' is repeated"), given->pattern); - hashmap_remove(&pl->parent_hashmap, &translated->ent, &data); - free(data); - free(translated); + goto clear_hashmaps; } return; |