Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/xdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-08-10 01:18:18 +0300
committerJunio C Hamano <gitster@pobox.com>2019-08-10 01:18:18 +0300
commitae76814c6ca1af63f947c3525dfd1a799c3d9fd4 (patch)
tree1b37970c2a541ad4550465061efc718e83e5e354 /xdiff
parent4d8ec15c66f32e29e4dfcdf64d0826c425d8ad7d (diff)
parentb777f3fd619ac2af507ffd3e7c5fe0d6e36e81f2 (diff)
Merge branch 'jk/xdiff-clamp-funcname-context-index' into maint
The internal diff machinery can be made to read out of bounds while looking for --funcion-context line in a corner case, which has been corrected. * jk/xdiff-clamp-funcname-context-index: xdiff: clamp function context indices in post-image
Diffstat (limited to 'xdiff')
-rw-r--r--xdiff/xemit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/xdiff/xemit.c b/xdiff/xemit.c
index 7778dc2b19..30713ae9a9 100644
--- a/xdiff/xemit.c
+++ b/xdiff/xemit.c
@@ -210,7 +210,7 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
if (fs1 < 0)
fs1 = 0;
if (fs1 < s1) {
- s2 -= s1 - fs1;
+ s2 = XDL_MAX(s2 - (s1 - fs1), 0);
s1 = fs1;
}
}
@@ -232,7 +232,7 @@ int xdl_emit_diff(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
if (fe1 < 0)
fe1 = xe->xdf1.nrec;
if (fe1 > e1) {
- e2 += fe1 - e1;
+ e2 = XDL_MIN(e2 + (fe1 - e1), xe->xdf2.nrec);
e1 = fe1;
}