]> git.ipfire.org Git - thirdparty/git.git/commit
pack-revindex.c: guard against out-of-bounds pack lookups
authorTaylor Blau <me@ttaylorr.com>
Tue, 11 Jun 2024 17:28:24 +0000 (13:28 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 11 Jun 2024 23:08:28 +0000 (16:08 -0700)
commite162aed591154612cbc646ab19808096d226fce5
tree42175f25903d173185931ed7a5af6d20953e27f8
parented4a1d6ae10e2c86ae8e05f485c3c6ad7e6da077
pack-revindex.c: guard against out-of-bounds pack lookups

The function midx_key_to_pack_pos() is a helper function used by
midx_to_pack_pos() and midx_pair_to_pack_pos() to translate a (pack,
offset) tuple into a position into the MIDX pseudo-pack order.

Ensure that the pack ID given to midx_pair_to_pack_pos() is bounded by
the number of packs within the MIDX to prevent, for instance,
uninitialized memory from being used as a pack ID.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pack-revindex.c