Reapply possible bsearch overflow fix
Originally introduced in 21ede86
(#1314) but as it wasn't applied to hb_bsearch
accidentally removed while merging hb_bsearch_r to it.
This commit is contained in:
parent
5846884f86
commit
760eb1bf93
|
@ -613,7 +613,7 @@ hb_bsearch (const void *key, const void *base,
|
|||
int min = 0, max = (int) nmemb - 1;
|
||||
while (min <= max)
|
||||
{
|
||||
int mid = (min + max) / 2;
|
||||
int mid = ((unsigned int) min + (unsigned int) max) / 2;
|
||||
const void *p = (const void *) (((const char *) base) + (mid * size));
|
||||
int c = compar (key, p, ds...);
|
||||
if (c < 0)
|
||||
|
|
Loading…
Reference in New Issue