未验证 提交 760eb1bf 编写于 作者: E Ebrahim Byagowi 提交者: GitHub

Reapply possible bsearch overflow fix

Originally introduced in 21ede867 (#1314) but as it wasn't applied to hb_bsearch
accidentally removed while merging hb_bsearch_r to it.
上级 5846884f
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册