Huw Davies : dplayx: Prevent out-of-bounds access to lpMemArea.

Alexandre Julliard julliard at winehq.org
Thu May 31 15:56:56 CDT 2018


Module: wine
Branch: master
Commit: 18e532d6452e45772c0d435bfefd1fbf68442e58
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=18e532d6452e45772c0d435bfefd1fbf68442e58

Author: Huw Davies <huw at codeweavers.com>
Date:   Wed May 30 13:01:56 2018 +0100

dplayx: Prevent out-of-bounds access to lpMemArea.

Based on a patch by Andrey Gusev.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dplayx/dplayx_global.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/dplayx/dplayx_global.c b/dlls/dplayx/dplayx_global.c
index 14c53a0..bc087c8 100644
--- a/dlls/dplayx/dplayx_global.c
+++ b/dlls/dplayx/dplayx_global.c
@@ -120,9 +120,9 @@ static LPVOID DPLAYX_PrivHeapAlloc( DWORD flags, DWORD size )
 
   /* Find blank area */
   uBlockUsed = 0;
-  while( lpMemArea[ uBlockUsed ].used && uBlockUsed <= dwMaxBlock ) { uBlockUsed++; }
+  while( uBlockUsed < dwMaxBlock && lpMemArea[ uBlockUsed ].used ) { uBlockUsed++; }
 
-  if( uBlockUsed <= dwMaxBlock )
+  if( uBlockUsed < dwMaxBlock )
   {
     /* Set the area used */
     lpMemArea[ uBlockUsed ].used = TRUE;




More information about the wine-cvs mailing list