In commit 44f9fd6496 (pack-bitmap.c: check preferred pack validity when opening MIDX bitmap, 2022-05-24) we started opening all packs contained within a MIDX when loading its corresponding bitmap. However, if a pack is missing, then we will emit a warning like: warning: could not open pack pack-$HASH.pack Later on commit f31a17cea5 (pack-bitmap.c: open and store incremental bitmap layers, 2025-03-20) updated this code to work with incremental MIDX bitmaps, but did not adjust the index into the 'pack_names' field. So if there is a pack in an incremental MIDX chain with a pack in a MIDX layer with a non-zero number of packs in its base layer(s) (in other words, any MIDX layer outside of the first one) that cannot be loaded, we will do an out-of-bounds lookup. Adjust the lookup into the 'pack_names' array by the number of packs in the base to prevent a potential SIGSEGV here. Signed-off-by: Taylor Blau <me@xxxxxxxxxxxx> --- pack-bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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]); goto cleanup; } } -- 2.49.0.641.gb9c9c4c3bd