Skip to content

Commit 86f660b

Browse files
Andre NollJunio C Hamano
authored andcommitted
object-refs: avoid division by zero
Currently, we don't check refs_hash_size size and happily call lookup_object_refs() even if refs_hash_size is zero which leads to a division by zero in hash_obj(). Signed-off-by: Andre Noll <maan@systemlinux.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent bb9e15a commit 86f660b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

object-refs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ void mark_reachable(struct object *obj, unsigned int mask)
127127

128128
if (!track_object_refs)
129129
die("cannot do reachability with object refs turned off");
130+
/* nothing to lookup */
131+
if (!refs_hash_size)
132+
return;
130133
/* If we've been here already, don't bother */
131134
if (obj->flags & mask)
132135
return;

0 commit comments

Comments
 (0)