Re: [PATCH 1/8] t/helper: add 'test-tool bitmap write' subcommand
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Apr 14, 2026, 21:40 UTC
- Message-ID
- <ad60PJ/pM/wG3krQ@nand.local>
- In-Reply-To
- <xmqqeckh9uew.fsf@gitster.g>
On Tue, Apr 14, 2026 at 01:08:39PM -0700, Junio C Hamano wrote:
Show 7 quoted lines
> What happens when a repeated call to this function to add many > objects (those contained within the pack we are iterating over) > caused the packlist_alloc() to realloc data->packed->objects[] array > eventually? Wouldn't it invalidate the address of &entry->idx we > are taking from before the realloc() happens? > > I must be missing something?
Good catch, I'm the one that is missing something here, not you. This is definitely a use-after-realloc(), though in practice it won't bite us because we are likely extending into an over-sized heap allocation without actually moving the data.
I don't know why I thought we allocated the packlist with a fixed size equal to p->num_objects ahead of time, but we don't, and this is clearly a bug.
Will fix, and thanks again for spotting.
Thanks, Taylor