You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The fill_packs_from_midx() method was refactored in fcb2205 (midx:
implement support for writing incremental MIDX chains, 2024-08-06) to
allow for preferred packfiles and incremental multi-pack-indexes.
However, this led to some conditions that can cause improperly
initialized memory in the context's list of packfiles.
The conditions caring about the preferred pack name or the incremental
flag are currently necessary to load a packfile. But the context is
still being populated with pack_info structs based on the packfile array
for the existing multi-pack-index even if prepare_midx_pack() isn't
called.
I'm not sure how to reproduce this situation in a test case (and it
would be great if I could) but some calls to the 'repack' or 'expire'
subcommand of 'git multi-pack-index' could segfault later due to these
improperly initialized pack_info structs. The current change does fix
the large, real-world case that I had observed with a debugger.
It is worth noting that there are test cases around the 'expire'
subcommand that will fail if we attempt to open the pack index during
this loop, or if we ignore packs that fail to open the pack index in
this loop. The removal of the calls to open_pack_index() reverts back to
the condition before this was refactored. The only instance where this
mattered was a check to see if the preferred packfile had objects or
not, so the initialization of the preferred pack was deferred to that
place.
To the best of my knowledge, the incremental feature does not require
the pack-indexes to be opened during this process.
Signed-off-by: Derrick Stolee <[email protected]>
0 commit comments