=?UTF-8?Q?Fr=C3=A9d=C3=A9ric=20Delanoy=20?=: ntdll: Avoid potential integer overflow when computing median position in bsearch.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Jul 3 12:54:50 CDT 2014
Module: wine
Branch: master
Commit: ec3a9a54f57646bf1b103a8c416306c44e4a412b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ec3a9a54f57646bf1b103a8c416306c44e4a412b
Author: Frédéric Delanoy <frederic.delanoy at gmail.com>
Date: Thu Jul 3 12:19:25 2014 +0200
ntdll: Avoid potential integer overflow when computing median position in bsearch.
---
dlls/ntdll/misc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/ntdll/misc.c b/dlls/ntdll/misc.c
index 659d504..ad1b43b 100644
--- a/dlls/ntdll/misc.c
+++ b/dlls/ntdll/misc.c
@@ -299,7 +299,7 @@ NTDLL_bsearch( const void *key, const void *base, size_t nmemb,
while (min <= max)
{
- ssize_t cursor = (min + max) / 2;
+ ssize_t cursor = min + (max - min) / 2;
int ret = compar(key,(const char *)base+(cursor*size));
if (!ret)
return (char*)base+(cursor*size);
More information about the wine-cvs
mailing list