public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Eric Sunshine <sunshine@sunshineco•com>
Cc: Dilyan Palauzov <dilyan.palauzov@aegee•org>, git@vger•kernel.org
Subject: Re: git 2.2.2 annotate crash (strbuf.c:32)
Date: Mon, 09 Feb 2015 12:50:35 -0800	[thread overview]
Message-ID: <xmqq7fvqbyhw.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20150209184612.GA4327@flurp.local> (Eric Sunshine's message of "Mon, 9 Feb 2015 13:46:12 -0500")

Eric Sunshine <sunshine@sunshineco•com> writes:

> There is a bit of suspicious code in builtin/blame.c where it is
> destroying the commit_info without ever initializing it,...

Good eyes.  I wonder why the compiler does not notice it.

It seems that this came from ea02ffa3 (mailmap:
simplify map_user() interface, 2013-01-05) and dates back to 1.8.2
or so.

> diff --git a/builtin/blame.c b/builtin/blame.c
> index 303e217..a3cc972 100644
> --- a/builtin/blame.c
> +++ b/builtin/blame.c
> @@ -2085,7 +2085,6 @@ static void find_alignment(struct scoreboard *sb, int *option)
>  
>  	for (e = sb->ent; e; e = e->next) {
>  		struct origin *suspect = e->suspect;
> -		struct commit_info ci;
>  		int num;
>  
>  		if (compute_auto_abbrev)
> @@ -2096,6 +2095,7 @@ static void find_alignment(struct scoreboard *sb, int *option)
>  		if (longest_file < num)
>  			longest_file = num;
>  		if (!(suspect->commit->object.flags & METAINFO_SHOWN)) {
> +			struct commit_info ci;
>  			suspect->commit->object.flags |= METAINFO_SHOWN;
>  			get_commit_info(suspect->commit, &ci, 1);
>  			if (*option & OUTPUT_SHOW_EMAIL)
> @@ -2104,6 +2104,7 @@ static void find_alignment(struct scoreboard *sb, int *option)
>  				num = utf8_strwidth(ci.author.buf);
>  			if (longest_author < num)
>  				longest_author = num;
> +			commit_info_destroy(&ci);
>  		}
>  		num = e->s_lno + e->num_lines;
>  		if (longest_src_lines < num)
> @@ -2113,8 +2114,6 @@ static void find_alignment(struct scoreboard *sb, int *option)
>  			longest_dst_lines = num;
>  		if (largest_score < ent_score(sb, e))
>  			largest_score = ent_score(sb, e);
> -
> -		commit_info_destroy(&ci);
>  	}
>  	max_orig_digits = decimal_width(longest_src_lines);
>  	max_digits = decimal_width(longest_dst_lines);

      parent reply	other threads:[~2015-02-09 20:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-08 21:33 git 2.2.2 annotate crash (strbuf.c:32) Dilyan Palauzov
2015-02-09  1:28 ` Jeff King
2015-02-09  4:39   ` Eric Sunshine
2015-02-09 10:33     ` Dilyan Palauzov
2015-02-09 18:46       ` Eric Sunshine
2015-02-09 19:22         ` Dilyan Palauzov
2015-02-09 20:50         ` Junio C Hamano [this message]

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=xmqq7fvqbyhw.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=dilyan.palauzov@aegee$(echo .)org \
    --cc=git@vger$(echo .)kernel.org \
    --cc=sunshine@sunshineco$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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