Skip to content

Commit 9bcdaab

Browse files
committed
Merge branch 'jk/check-pack-valid-before-opening-bitmap'
A race between repacking and using pack bitmaps has been corrected. * jk/check-pack-valid-before-opening-bitmap: pack-bitmap: check pack validity when opening bitmap
2 parents 8230107 + dc1daac commit 9bcdaab

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pack-bitmap.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,11 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git
298298
return -1;
299299
}
300300

301+
if (!is_pack_valid(packfile)) {
302+
close(fd);
303+
return -1;
304+
}
305+
301306
bitmap_git->pack = packfile;
302307
bitmap_git->map_size = xsize_t(st.st_size);
303308
bitmap_git->map = xmmap(NULL, bitmap_git->map_size, PROT_READ, MAP_PRIVATE, fd, 0);

0 commit comments

Comments
 (0)