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 2019-06-03 05:48:04 -07:00 committed by GitHub
parent 5846884f86
commit 760eb1bf93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

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)