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:
Ebrahim Byagowi authored and GitHub committed 2019-06-03 05:48:04 -07:00
1 parent 5846884f86
commit 760eb1bf93
1 file changed
+1 -1
+1 -1
View File
@@ -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)