git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: bugreport - SEGFAULT on 'git show-branch --current --reflog=3'

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Apr 13, 2022, 18:46 UTC
Message-ID
<220413.86wnfses7c.gmgdl@evledraar.gmail.com>
In-Reply-To
<6d510d78-9b0b-c463-889b-cd3855ccdd1b@p1sec.com>
On Wed, Apr 13 2022, Gregory David wrote:
Show 18 quoted lines
> [[PGP Signed Part:Undecided]]
> Thanks a lot Aevar!
>
> Don't you mean this:
>
> diff --git a/builtin/show-branch.c b/builtin/show-branch.c
> index 330b0553b9..2a5c31729d 100644
> --- a/builtin/show-branch.c
> +++ b/builtin/show-branch.c
> @@ -881,7 +881,7 @@ int cmd_show_branch(int ac, const char **av, const
> char *prefix)
>                                        get_color_reset_code(), ref_name[i]);
>                         }
>
> -                       if (!reflog) {
> +                       if (!reflog || !rev[i]) {
>                                 /* header lines never need name */
>                                 show_one_commit(rev[i], 1);

No, but my "suggested" fix was just enough to compile and get past the segfault, i.e. we don't reach the puts(reflog_msg[i]) branch, but of course rev[i] may be NULL too, I didn't check.

For this one though: I haven't tried it, but reading show_one_commit() one of the first things we do is dereference the 1st argument, so surely that will segfault too...

Previous: Gregory DavidNext: Gregory David
Message 4 of 6 in “bugreport - SEGFAULT on 'git show-branch --current --reflog=3'”
  1. Gregory DavidApr 13, 2022
  2. Ævar Arnfjörð BjarmasonApr 13, 2022
  3. Gregory DavidApr 13, 2022
  4. Ævar Arnfjörð BjarmasonApr 13, 2022
  5. Gregory DavidApr 14, 2022
  6. Gregory DavidApr 14, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.