зеркало из https://github.com/microsoft/git.git
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>
This commit is contained in:
Родитель
4baff50551
Коммит
e5e9b56528
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче