Re: [PATCH 07/11] bundle: safely handle --objects option
From: Junio C Hamano <hidden>
Date: 2022-03-04 22:57:27
"Derrick Stolee via GitGitGadget" [off-list ref] writes:
From: Derrick Stolee <redacted> 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.