Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'pack-revindex.c')
-rw-r--r--pack-revindex.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/pack-revindex.c b/pack-revindex.c
index c3f2aaa3fe..007a806994 100644
--- a/pack-revindex.c
+++ b/pack-revindex.c
@@ -5,6 +5,7 @@
#include "packfile.h"
#include "config.h"
#include "midx.h"
+#include "csum-file.h"
struct revindex_entry {
off_t offset;
@@ -309,6 +310,15 @@ int load_pack_revindex(struct repository *r, struct packed_git *p)
*/
int verify_pack_revindex(struct packed_git *p)
{
+ /* Do not bother checking if not initialized. */
+ if (!p->revindex_map)
+ return 0;
+
+ if (!hashfile_checksum_valid((const unsigned char *)p->revindex_map, p->revindex_size)) {
+ error(_("invalid checksum"));
+ return -1;
+ }
+
return 0;
}