author | Junio C Hamano <gitster@pobox.com> | |
Sat, 26 Feb 2011 00:55:26 +0000 (16:55 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 28 Feb 2011 07:29:03 +0000 (23:29 -0800) | ||
commit | 3c9fc074c220d5d1d2173c84cc6ae57d750e2a2c | |
tree | 99a89b4e8eaf51852e90679e553eeb44cf5e7cf6 | tree | snapshot |
parent | fb956c1f44b5c99273eb9e3850717c8b489ff78f | commit | diff |
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>
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>
builtin/index-pack.c | diff | blob | history | |
pack-write.c | diff | blob | history | |
pack.h | diff | blob | history | |
t/t5302-pack-index.sh | diff | blob | history |