Git development
 help / color / mirror / Atom feed
From: "Matt Hunter" <m@lfurio.us>
To: "Junio C Hamano" <gitster@pobox.com>,
	"Trevor Gross" <tg@trevorgross.com>
Cc: <git@vger.kernel.org>, "Jeff King" <peff@peff.net>,
	"Stefan Haller" <lists@haller-berlin.de>,
	"Derrick Stolee" <stolee@gmail.com>,
	"Phillip Wood" <phillip.wood@dunelm.org.uk>
Subject: Re: [PATCH] rebase -i: introduce `pick -x` to add "cherry picked from commit ..."
Date: Sun, 05 Jul 2026 18:23:52 -0400	[thread overview]
Message-ID: <DJQZMN6UIPBY.Z6WBNUP1E3U2@lfurio.us> (raw)
In-Reply-To: <xmqqldbpclhh.fsf@gitster.g>

On Sun Jul 5, 2026 at 2:58 PM EDT, Junio C Hamano wrote:
> Trevor Gross <tg@trevorgross.com> writes:
>> @@ -5524,7 +5533,7 @@ static int single_pick(struct repository *r,
>>  		       struct replay_opts *opts)
>>  {
>>  	int check_todo;
>> -	struct todo_item item;
>> +	struct todo_item item = { 0 };
>
> This may be a good change, but I do not think the proposed commit log
> message touched upon it.  It should.  Is it a bug that we somehow were
> lucky that nobody made an access to uninitialized piece of memory here?

On a first glance, do_pick_commit() was only referencing the 'command'
and 'commit' fields of struct todo_item.  Trevor added a reference to
item->flags which created the need to initialize it here.

However, on a second glance, there _is_ a pre-existing reference to
item->flags in do_pick_commit() as well, at line 2410 on master
(e9019fcafe00):

    if (command == TODO_REWORD)
        reword = 1;
    else if (is_fixup(command)) {
        if (update_squash_messages(r, command, commit,
                       opts, item->flags)) {
            res = -1;
            goto leave;
        }

It doesn't look like this code is actually reachable from single_pick()
as written, since it is guarded by is_fixup(command) and single_pick()
doesn't set such a command.

  reply	other threads:[~2026-07-05 22:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-05 14:09 [PATCH] rebase -i: introduce `pick -x` to add "cherry picked from commit ..." Trevor Gross
2026-07-05 18:58 ` Junio C Hamano
2026-07-05 22:23   ` Matt Hunter [this message]
2026-07-05 20:52 ` Junio C Hamano
2026-07-06  0:24 ` Jeff King
2026-07-06 10:08   ` Phillip Wood
2026-07-06 20:24     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DJQZMN6UIPBY.Z6WBNUP1E3U2@lfurio.us \
    --to=m@lfurio.us \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=lists@haller-berlin.de \
    --cc=peff@peff.net \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=stolee@gmail.com \
    --cc=tg@trevorgross.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox