Merge branch 'jk/chunk-bounds'
The codepaths that read "chunk" formatted files have been corrected to pay attention to the chunk size and notice broken files. * jk/chunk-bounds: (21 commits) t5319: make corrupted large-offset test more robust chunk-format: drop pair_chunk_unsafe() commit-graph: detect out-of-order BIDX offsets commit-graph: check bounds when accessing BIDX chunk commit-graph: check bounds when accessing BDAT chunk commit-graph: bounds-check generation overflow chunk commit-graph: check size of generations chunk commit-graph: bounds-check base graphs chunk commit-graph: detect out-of-bounds extra-edges pointers commit-graph: check size of commit data chunk midx: check size of revindex chunk midx: bounds-check large offset chunk midx: check size of object offset chunk midx: enforce chunk alignment on reading midx: check size of pack names chunk commit-graph: check consistency of fanout table midx: check size of oid lookup chunk commit-graph: check size of oid fanout chunk midx: stop ignoring malformed oid fanout chunk t: add library for munging chunk-format files ...
This commit is contained in:
@@ -343,6 +343,17 @@ int verify_pack_revindex(struct packed_git *p)
|
||||
return res;
|
||||
}
|
||||
|
||||
static int can_use_midx_ridx_chunk(struct multi_pack_index *m)
|
||||
{
|
||||
if (!m->chunk_revindex)
|
||||
return 0;
|
||||
if (m->chunk_revindex_len != st_mult(sizeof(uint32_t), m->num_objects)) {
|
||||
error(_("multi-pack-index reverse-index chunk is the wrong size"));
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int load_midx_revindex(struct multi_pack_index *m)
|
||||
{
|
||||
struct strbuf revindex_name = STRBUF_INIT;
|
||||
@@ -351,7 +362,7 @@ int load_midx_revindex(struct multi_pack_index *m)
|
||||
if (m->revindex_data)
|
||||
return 0;
|
||||
|
||||
if (m->chunk_revindex) {
|
||||
if (can_use_midx_ridx_chunk(m)) {
|
||||
/*
|
||||
* If the MIDX `m` has a `RIDX` chunk, then use its contents for
|
||||
* the reverse index instead of trying to load a separate `.rev`
|
||||
|
||||
Reference in New Issue
Block a user