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>
Andre Noll committed
Jun 21, 2006 at 04:46 UTC
86f660b1f1dc207897281a77f969a56b2e551374
1 file changed
+3
object-refs.c
+3
@@ -127,6 +127,9 @@ void mark_reachable(struct object *obj, unsigned int mask)
127
128
if (!track_object_refs)
129
die("cannot do reachability with object refs turned off");
130
+ /* nothing to lookup */
131
+ if (!refs_hash_size)
132
+ return;
133
/* If we've been here already, don't bother */
134
if (obj->flags & mask)
135
return;