Skip to content

Commit

Permalink
object-refs: avoid division by zero
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andre Noll authored and Junio C Hamano committed Jun 21, 2006
1 parent bb9e15a commit 86f660b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions object-refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ void mark_reachable(struct object *obj, unsigned int mask)

if (!track_object_refs)
die("cannot do reachability with object refs turned off");
/* nothing to lookup */
if (!refs_hash_size)
return;
/* If we've been here already, don't bother */
if (obj->flags & mask)
return;
Expand Down

0 comments on commit 86f660b

Please sign in to comment.