From: Matt Hunter Date: Sun, 05 Jul 2026 22:23:52 GMT Subject: Re: [PATCH] rebase -i: introduce `pick -x` to add "cherry picked from commit ..." Message-ID: In-Reply-To: On Sun Jul 5, 2026 at 2:58 PM EDT, Junio C Hamano wrote: > Trevor Gross 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.