summaryrefslogtreecommitdiff
path: root/pack-bitmap-write.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2016-09-22 03:49:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-09-22 18:18:13 (GMT)
commita9445d859e810cc193c1cdcb15fa684a5e9b7560 (patch)
treed7a8e694d93a243a46272a4201d96dc4914cf4af /pack-bitmap-write.c
parent0b65a8dbdb38962e700ee16776a3042beb489060 (diff)
downloadgit-a9445d859e810cc193c1cdcb15fa684a5e9b7560.zip
git-a9445d859e810cc193c1cdcb15fa684a5e9b7560.tar.gz
git-a9445d859e810cc193c1cdcb15fa684a5e9b7560.tar.bz2
verify_packfile: check pack validity before accessing data
The verify_packfile() does not explicitly open the packfile; instead, it starts with a sha1 checksum over the whole pack, and relies on use_pack() to open the packfile as a side effect. If the pack cannot be opened for whatever reason (either because its header information is corrupted, or perhaps because a simultaneous repack deleted it), then use_pack() will die(), as it has no way to return an error. This is not ideal, as verify_packfile() otherwise tries to gently return an error (this lets programs like git-fsck go on to check other packs). Instead, let's check is_pack_valid() up front, and return an error if it fails. This will open the pack as a side effect, and then use_pack() will later rely on our cached descriptor, and avoid calling die(). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack-bitmap-write.c')
0 files changed, 0 insertions, 0 deletions