index-pack --verify: read anomalous offsets from v2 idx file
A pack v2 .idx file usually records offset using 64-bit representation only when the offset does not fit within 31-bit, but you can handcraft your .idx file to record smaller offset using 64-bit, storing all zero in the upper 4-byte. By inspecting the original idx file when running index-pack --verify, encode such low offsets that do not need to be in 64-bit but are encoded using 64-bit just like the original idx file so that we can still validate the pack/idx pair by comparing the idx file recomputed with the original. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
8
pack.h
8
pack.h
@ -41,6 +41,14 @@ struct pack_idx_option {
|
||||
|
||||
uint32_t version;
|
||||
uint32_t off32_limit;
|
||||
|
||||
/*
|
||||
* List of offsets that would fit within off32_limit but
|
||||
* need to be written out as 64-bit entity for byte-for-byte
|
||||
* verification.
|
||||
*/
|
||||
int anomaly_alloc, anomaly_nr;
|
||||
uint32_t *anomaly;
|
||||
};
|
||||
|
||||
extern void reset_pack_idx_option(struct pack_idx_option *);
|
||||
|
Reference in New Issue
Block a user