Re: [PATCH 07/11] bundle: safely handle --objects option
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 4, 2022, 22:57 UTC
- Message-ID
- <xmqqmti5xr59.fsf@gitster.g>
- In-Reply-To
- <1476a9495c53a165e6971afe75205889524fe7ca.1645638911.git.gitgitgadget@gmail.com>
"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 17 quoted lines
> From: Derrick Stolee <derrickstolee@github.com> > > Since 'git bundle' uses setup_revisions() to specify the object walk, > some options do not make sense to include during the pack-objects child > process. Further, these options are used for a call to > traverse_commit_list() which would then require a callback which is > currently NULL. > > By populating the callback we prevent a segfault in the case of adding > the --objects flag. This is really a redundant statement because the > bundles are constructing a pack-file containing all objects in the > discovered commit range. > > Adding --objects to a 'git bundle' command might cause a slower command, > but at least it will not have a hard failure when the user supplies this > option. We can also disable walking trees and blobs in advance of this > walk.
Wow. That's fun.
This commit makes me wonder if we are safe with --max-parents=, --author=, and other nonsense options, but it is obvious that it is a segfault waiting to happen by passing NULL to object callback, which makes it worth singling out "--objects" and dedicate a commit to fix it.