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
This commit is contained in:
Junio C Hamano 2021-08-02 14:06:43 -07:00
Родитель 8230107f33 dc1daacdcc
Коммит 9bcdaab13e
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -298,6 +298,11 @@ static int open_pack_bitmap_1(struct bitmap_index *bitmap_git, struct packed_git
return -1;
}
if (!is_pack_valid(packfile)) {
close(fd);
return -1;
}
bitmap_git->pack = packfile;
bitmap_git->map_size = xsize_t(st.st_size);
bitmap_git->map = xmmap(NULL, bitmap_git->map_size, PROT_READ, MAP_PRIVATE, fd, 0);