From: Taylor Blau Date: Tue, 14 Apr 2026 21:40:12 GMT Subject: Re: [PATCH 1/8] t/helper: add 'test-tool bitmap write' subcommand Message-ID: In-Reply-To: On Tue, Apr 14, 2026 at 01:08:39PM -0700, Junio C Hamano wrote: > 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