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
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user