summaryrefslogtreecommitdiff
path: root/object-refs.c
diff options
context:
space:
mode:
authorAndre Noll <maan@systemlinux.org>2006-06-21 02:46:05 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-06-21 10:56:00 (GMT)
commit86f660b1f1dc207897281a77f969a56b2e551374 (patch)
treef56cf9718b70af684c6f6b5a389c8a18eed75448 /object-refs.c
parentbb9e15a83c425ff31e4da6b004bd4557d528b755 (diff)
downloadgit-86f660b1f1dc207897281a77f969a56b2e551374.zip
git-86f660b1f1dc207897281a77f969a56b2e551374.tar.gz
git-86f660b1f1dc207897281a77f969a56b2e551374.tar.bz2
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>
Diffstat (limited to 'object-refs.c')
-rw-r--r--object-refs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/object-refs.c b/object-refs.c
index 8afa227..a7d49c6 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;