Skip to content

Commit 1e951c6

Browse files
peffgitster
authored andcommitted
pack-bitmap: clean up include_check after use
When a bitmap walk has to traverse (to fill in non-bitmapped objects), we use rev_info's include_check mechanism to let us stop the traversal early. But after setting the function and its data parameter, we never clean it up. This means that if the rev_info is used for a subsequent traversal without bitmaps, it will unexpectedly call into our include_check function (worse, it will do so pointing to a now-defunct stack variable in include_check_data, likely resulting in a segfault). There's no code which does this now, but it's an accident waiting to happen. Let's clean up after ourselves in the bitmap code. Reported-by: David Emett <dave@sp4m.net> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 48bf2fa commit 1e951c6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pack-bitmap.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,9 @@ static struct bitmap *find_objects(struct bitmap_index *bitmap_git,
630630
traverse_commit_list_filtered(filter, revs,
631631
show_commit, show_object,
632632
&show_data, NULL);
633+
634+
revs->include_check = NULL;
635+
revs->include_check_data = NULL;
633636
}
634637

635638
return base;

0 commit comments

Comments
 (0)