Re: [PATCH 1/5] pack-bitmap.c: fix broken warning() when missing MIDX'd pack
- From
Patrick Steinhardt <ps@pks.im>
- Date
- May 26, 2025, 07:23 UTC
- Message-ID
- <aDQXBBrL2Ni69gwE@pks.im>
- In-Reply-To
- <ad7295b11b2e2c48d859623bf1bcfd92ef15ef9d.1748198489.git.me@ttaylorr.com>
On Sun, May 25, 2025 at 02:41:51PM -0400, Taylor Blau wrote:
Show 10 quoted lines
> diff --git a/pack-bitmap.c b/pack-bitmap.c
> index b9f1d86604..99c4927e9c 100644
> --- a/pack-bitmap.c
> +++ b/pack-bitmap.c
> @@ -490,7 +490,7 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git,
> for (i = 0; i < bitmap_git->midx->num_packs + bitmap_git->midx->num_packs_in_base; i++) {
> if (prepare_midx_pack(bitmap_repo(bitmap_git), bitmap_git->midx, i)) {
> warning(_("could not open pack %s"),
> - bitmap_git->midx->pack_names[i]);
> + bitmap_git->midx->pack_names[i - bitmap_git->midx->num_packs_in_base]);Doesn't this cause a negative array index though in the case where `prepare_midx_pack()` returns an error for any `i` smaller than the number of packs in base?
Patrick