]> git.ipfire.org Git - thirdparty/git.git/commit
midx: avoid negative array index
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Thu, 22 May 2025 15:55:22 +0000 (16:55 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 22 May 2025 21:48:37 +0000 (14:48 -0700)
commit3aa98a61da6e1403081b4dfaa0c644614d228bac
tree06608214889fd81273e01d0d963479dd1a8511fb
parentf874c0ed90c63276e0ebc445ad6fee5dcbfacb86
midx: avoid negative array index

nth_midxed_pack_int_id() returns the index of the pack file in the multi
pack index's list of packfiles that the specified object. The index is
returned as a uint32_t. Storing this in an int will make the index
negative if the most significant bit is set. Fix this by using uint32_t
as the rest of the code does. This is unlikely to be a practical problem
as it requires the multipack index to reference 2^31 packfiles.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
midx-write.c