diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-07-29 12:38:21 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-07-29 12:38:21 -0700 |
commit | 0324b6f035a19f0098c321a7e6e17c04e9405be2 (patch) | |
tree | 40c48dc63c49002a009de35657f04cd3d5db64b2 /builtin/ls-files.c | |
parent | Merge branch 'jk/trailers-use-config' into maint (diff) | |
parent | cleanup: fix possible overflow errors in binary search, part 2 (diff) | |
download | tgif-0324b6f035a19f0098c321a7e6e17c04e9405be2.tar.xz |
Merge branch 'rs/avoid-overflow-in-midpoint-computation' into maint
Code clean-up to avoid signed integer overlaps during binary search.
* rs/avoid-overflow-in-midpoint-computation:
cleanup: fix possible overflow errors in binary search, part 2
Diffstat (limited to 'builtin/ls-files.c')
-rw-r--r-- | builtin/ls-files.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/ls-files.c b/builtin/ls-files.c index 7f83c9a6f2..670e8fb93c 100644 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@ -373,7 +373,7 @@ static void prune_index(struct index_state *istate, first = pos; last = istate->cache_nr; while (last > first) { - int next = (last + first) >> 1; + int next = first + ((last - first) >> 1); const struct cache_entry *ce = istate->cache[next]; if (!strncmp(ce->name, prefix, prefixlen)) { first = next+1; |