git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Gregory David <gregory.david@p1sec.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: bugreport - SEGFAULT on 'git show-branch --current --reflog=3'
Date: Thu, 14 Apr 2022 07:20:21 +0000	[thread overview]
Message-ID: <d72ac546-7c0d-6b05-5b8b-0c4b96192135@p1sec.com> (raw)
In-Reply-To: <220413.86wnfses7c.gmgdl@evledraar.gmail.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 1519 bytes --]

By my side, your first suggestion didn't remove the segfault due to the
irrelevant check on 'reflog[i]' that is not use on next line, so unable
to segfault. The fact is you pointed the exact place where it happens
and my fix of your fix :) remove the segfault.

On 13/04/2022 18:46, Ævar Arnfjörð Bjarmason wrote:
> 
> On Wed, Apr 13 2022, Gregory David wrote:
> 
>> [[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...

-- 
Gregory David
Security Engineer
https://www.p1sec.com

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 2501 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 665 bytes --]

  reply	other threads:[~2022-04-14  7:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-13  8:39 bugreport - SEGFAULT on 'git show-branch --current --reflog=3' Gregory David
2022-04-13 13:57 ` Ævar Arnfjörð Bjarmason
2022-04-13 15:48   ` Gregory David
2022-04-13 18:46     ` Ævar Arnfjörð Bjarmason
2022-04-14  7:20       ` Gregory David [this message]
2022-04-14  7:40       ` Gregory David

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=d72ac546-7c0d-6b05-5b8b-0c4b96192135@p1sec.com \
    --to=gregory.david@p1sec.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).