=?UTF-8?Q?Fr=C3=A9d=C3=A9ric=20Delanoy=20?=: msvcrt: Avoid potential integer overflow when computing median position in bsearch.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jun 30 15:30:20 CDT 2014
Module: wine
Branch: master
Commit: b9e306ee78ee4bb7ee51b8ffc3cf7a54ed00a2e9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b9e306ee78ee4bb7ee51b8ffc3cf7a54ed00a2e9
Author: Frédéric Delanoy <frederic.delanoy at gmail.com>
Date: Sun Jun 29 12:05:36 2014 +0200
msvcrt: Avoid potential integer overflow when computing median position in bsearch.
---
dlls/msvcrt/misc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/msvcrt/misc.c b/dlls/msvcrt/misc.c
index d791699..fc5a5a9 100644
--- a/dlls/msvcrt/misc.c
+++ b/dlls/msvcrt/misc.c
@@ -139,7 +139,7 @@ void* CDECL MSVCRT_bsearch_s(const void *key, const void *base,
while (min <= max)
{
- ssize_t cursor = (min + max) / 2;
+ ssize_t cursor = min + (max - min) / 2;
int ret = compare(ctx, key,(const char *)base+(cursor*size));
if (!ret)
return (char*)base+(cursor*size);
More information about the wine-cvs
mailing list