From: Andre Noll Date: Wed, 21 Jun 2006 02:46:05 +0000 (+0200) Subject: object-refs: avoid division by zero X-Git-Tag: v1.4.1-rc1~3^2~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=86f660b1f1dc207897281a77f969a56b2e551374;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/object-refs.c b/object-refs.c index 8afa2276f..a7d49c60d 100644 --- a/object-refs.c +++ b/object-refs.c @@ -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;