Re: [PATCH] revision.c: set-up "index_state.repo", don't segfault in pack-objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/5/2022 10:24 AM, Ævar Arnfjörð Bjarmason wrote:
> Narrowly fix a segfault that's been reported against pack-objects at
> [1] and [2].
> 
> This fixes a segfault in "git pack-objects", see a reports at [1] and
> [2]. In that case we'd go through the add_index_objects_to_pending()
> codepath being modified here, and eventually call into
> new_untracked_cache().
> 
> We'd then segfault in new_untracked_cache_flags() as we tried to use a
> NULL "repo" extracted from the "struct index_state".

>  		struct worktree *wt = *p;
> -		struct index_state istate = { NULL };
> +		struct index_state istate = { .repo = revs->repo };
  
Thanks for the fix. It is definitely narrow to this particular
stack trace.

It is rare that we create an index that is not 'the_index' in
this way. However, there are similar { NULL } initializers that
could be cleaned up in these files:

 * apply.c
 * merge-recursive.c
 * builtin/stash.c
 * builtin/worktree.c

Of course, delay these for a follow-up since these uses are
not causing segfaults in the wild.

Thanks,
-Stolee




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux