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>
This commit is contained in:
Nicolas Pitre
2008-10-29 19:02:49 -04:00
committed by Junio C Hamano
parent 03d660150c
commit 08698b1e32
3 changed files with 16 additions and 7 deletions

View File

@ -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;