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
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-05-13 22:19:20 +0300
committerJunio C Hamano <gitster@pobox.com>2020-05-13 22:19:20 +0300
commitce1adb11571f3196afa07642fdda37b6bbbc5aa4 (patch)
tree68b6f5d32a5b1d06f3d621229b00db095fd0c224
parent9e8ed173b4cc4f1855501a7c8ffab6ffbc5bf34d (diff)
parent0eeb3be4c4b297f9edb94c4741af606df396985d (diff)
Merge branch 'ds/sparse-updates-oob-access-fix'
The code to skip unmerged paths in the index when sparse checkout is in use would have made out-of-bound access of the in-core index when the last path was unmerged, which has been corrected. * ds/sparse-updates-oob-access-fix: unpack-trees: avoid array out-of-bounds error
-rw-r--r--unpack-trees.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index 1fe3764f2b..02048dfdac 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -562,11 +562,11 @@ static int warn_conflicted_path(struct index_state *istate,
add_rejected_path(o, WARNING_SPARSE_UNMERGED_FILE, conflicting_path);
- /* Find out how many higher stage entries at same path */
- while (++count < istate->cache_nr &&
- !strcmp(conflicting_path,
- istate->cache[i+count]->name))
- /* do nothing */;
+ /* Find out how many higher stage entries are at same path */
+ while ((++count) + i < istate->cache_nr &&
+ !strcmp(conflicting_path, istate->cache[count + i]->name))
+ ; /* do nothing */
+
return count;
}