summaryrefslogtreecommitdiff
path: root/builtin-pack-objects.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2008-10-29 23:02:49 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-11-02 23:22:35 (GMT)
commit08698b1e32bc414f214b7300b40c30a30d9ecd1c (patch)
tree1fc01119e8590049d0f5e5949b4b6a9d83db75eb /builtin-pack-objects.c
parent03d660150cbc80cd7d2ec90c3c4e6ce563295e3a (diff)
downloadgit-08698b1e32bc414f214b7300b40c30a30d9ecd1c.zip
git-08698b1e32bc414f214b7300b40c30a30d9ecd1c.tar.gz
git-08698b1e32bc414f214b7300b40c30a30d9ecd1c.tar.bz2
make find_pack_revindex() aware of the nasty world
It currently calls die() whenever given offset is not found thinking that such thing should never happen. But this offset may come from a corrupted pack whych _could_ happen and not be found. Callers should deal with this possibility gracefully instead. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-pack-objects.c')
-rw-r--r--builtin-pack-objects.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index c05fb94..04a5a55 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -1053,6 +1053,8 @@ static void check_object(struct object_entry *entry)
if (reuse_delta && !entry->preferred_base) {
struct revindex_entry *revidx;
revidx = find_pack_revindex(p, ofs);
+ if (!revidx)
+ goto give_up;
base_ref = nth_packed_object_sha1(p, revidx->nr);
}
entry->in_pack_header_size = used + used_0;