From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Cc: "Zbigniew Jędrzejewski-Szmek" <zbyszek@in.waw.pl>,
"Julia Lawall" <julia.lawall@lip6.fr>
Subject: Re: git show loop
Date: Sat, 24 Mar 2012 16:18:46 +0100 [thread overview]
Message-ID: <4F6DE5D6.4010408@lsrfire.ath.cx> (raw)
In-Reply-To: <4F6DC151.9040707@in.waw.pl>
Am 24.03.2012 13:42, schrieb Zbigniew Jędrzejewski-Szmek:
> On 03/24/2012 12:50 PM, Zbigniew Jędrzejewski-Szmek wrote:
>> On 03/24/2012 11:05 AM, Julia Lawall wrote:
>>> In linux, git show 60d9aa7 -U0 goes into an infinite loop.
>
> Bisect points to
> commit b810cbbde9232cbe9a3841edccc5b606bbd3a82e (refs/bisect/bad)
> Author: Junio C Hamano<gitster@pobox.com>
> Date: Wed Jul 22 14:48:29 2009 -0700
>
> diff --cc: a lost line at the beginning of the file is shown
> incorrectly
That's what I found as well, but I don't understand how this relates to
the patch below, which should fix the issue. Valgrind told me where to
look instead.
-- >8 --
Subject: [PATCH] combine-diff: fix loop index underflow
If both la and context are zero at the start of the loop, la wraps around
and we end up reading from memory far away. Skip the loop in that case
instead.
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
combine-diff.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/combine-diff.c b/combine-diff.c
index a2e8dcf..9786680 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -423,7 +423,7 @@ static int make_hunks(struct sline *sline, unsigned long cnt,
hunk_begin, j);
la = (la + context < cnt + 1) ?
(la + context) : cnt + 1;
- while (j <= --la) {
+ while (la && j <= --la) {
if (sline[la].flag & mark) {
contin = 1;
break;
--
1.7.9.2
next prev parent reply other threads:[~2012-03-24 15:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-24 10:05 git show loop Julia Lawall
2012-03-24 11:50 ` Zbigniew Jędrzejewski-Szmek
2012-03-24 12:42 ` Zbigniew Jędrzejewski-Szmek
2012-03-24 15:18 ` René Scharfe [this message]
2012-03-26 4:34 ` Junio C Hamano
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=4F6DE5D6.4010408@lsrfire.ath.cx \
--to=rene.scharfe@lsrfire.ath.cx \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=julia.lawall@lip6.fr \
--cc=zbyszek@in.waw.pl \
/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).