]> git.ipfire.org Git - thirdparty/git.git/blobdiff - pack-check.c
verify_packfile: check pack validity before accessing data
[thirdparty/git.git] / pack-check.c
index 1da89a41cec9e605fc3fdfa8efaaf2489e501c88..5af987c09b108740b766d6fe9db400a53c01dd7e 100644 (file)
@@ -57,11 +57,8 @@ static int verify_packfile(struct packed_git *p,
        int err = 0;
        struct idx_entry *entries;
 
-       /* Note that the pack header checks are actually performed by
-        * use_pack when it first opens the pack file.  If anything
-        * goes wrong during those checks then the call will die out
-        * immediately.
-        */
+       if (!is_pack_valid(p))
+               return error("packfile %s cannot be accessed", p->pack_name);
 
        git_SHA1_Init(&ctx);
        do {