diff options
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | 2012-03-24 19:18:46 +0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-03-26 08:35:52 +0400 |
commit | e5e9b56528294e9455d22d1abb21ad32f098a1be (patch) | |
tree | 12c6a871b24c161b553e7c32afa9a8d5fbbba716 | |
parent | 4baff50551545e2b6825973ec37bcaf03edb95fe (diff) |
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | combine-diff.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/combine-diff.c b/combine-diff.c index 9445e86c2f..45221f84a5 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -414,7 +414,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; |