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: Wed, 13 Apr 2022 15:48:57 +0000 [thread overview]
Message-ID: <6d510d78-9b0b-c463-889b-cd3855ccdd1b@p1sec.com> (raw)
In-Reply-To: <220413.864k2xgk51.gmgdl@evledraar.gmail.com>
[-- Attachment #1.1.1: Type: text/plain, Size: 2951 bytes --]
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);
}
Best regards.
On 13/04/2022 13:57, Ævar Arnfjörð Bjarmason wrote:
>
> On Wed, Apr 13 2022, Gregory David wrote:
>
>> [[PGP Signed Part:Undecided]]
>> Hi, this bugreport is about a SEGFAULT on git binary when running in
>> this repository (for example, as it also segfault on other private
>> repositories): https://framagit.org/groolot-association/osc_looper.git
>>
>>
>> What did you do before the bug happened? (Steps to reproduce your
>> issue) I just wanted to list branches, and so playing with 'git
>> show-branch --current --reflog=3' in the repository
>> https://framagit.org/groolot-association/osc_looper.git
>>
>> What did you expect to happen? (Expected behavior)
>> Not to segfault
>>
>> What happened instead? (Actual behavior)
>> This command fails with a SEGFAULT on version 2.35.1, 2.20.1 and 2.17.1
>> It also SEGFAULT on branch 'next' of github git repository.
>>
>> What's different between what you expected and what actually happened?
>> Segfault
>>
>> Anything else you want to add:
>> Segfaut happened when '--current' AND '--reflog=3' are provided together
>>
>> Please review the rest of the bug report below.
>> You can delete any lines you don't wish to share.
>>
>>
>> [System Info]
>> git version:
>> git version 2.35.1
>> cpu: x86_64
>> no commit associated with this build
>> sizeof-long: 8
>> sizeof-size_t: 8
>> shell-path: /bin/sh
>> uname: Linux 5.16.0-4-amd64 #1 SMP PREEMPT Debian 5.16.12-1 (2022-03-08)
>> x86_64
>> compiler info: gnuc: 11.2
>> libc info: glibc: 2.33
>> $SHELL (typically, interactive shell): /usr/bin/zsh
>
> This appears to fix it, but I didn't have time to further validate it,
> come up with a test etc:
>
> diff --git a/builtin/show-branch.c b/builtin/show-branch.c
> index 330b0553b9d..be3890b2dd6 100644
> --- a/builtin/show-branch.c
> +++ b/builtin/show-branch.c
> @@ -881,10 +881,9 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
> get_color_reset_code(), ref_name[i]);
> }
>
> - if (!reflog) {
> + if (!reflog || !reflog_msg[i])
> /* header lines never need name */
> show_one_commit(rev[i], 1);
> - }
> else
> puts(reflog_msg[i]);
>
>
--
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 --]
next prev parent reply other threads:[~2022-04-13 15:49 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 [this message]
2022-04-13 18:46 ` Ævar Arnfjörð Bjarmason
2022-04-14 7:20 ` Gregory David
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6d510d78-9b0b-c463-889b-cd3855ccdd1b@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.
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 NNTP newsgroup(s).