[PATCH v5 3/8] comctl32/listbox: Check for out of bounds index using an unsigned index

Gabriel Ivăncescu gabrielopcode at gmail.com
Thu Nov 22 07:44:39 CST 2018


Needed for LBS_NODATA.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
 dlls/comctl32/listbox.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/comctl32/listbox.c b/dlls/comctl32/listbox.c
index dbc7b4a..a380b59 100644
--- a/dlls/comctl32/listbox.c
+++ b/dlls/comctl32/listbox.c
@@ -483,7 +483,7 @@ static INT LISTBOX_GetItemFromPoint( const LB_DESCR *descr, INT x, INT y )
  * Paint an item.
  */
 static void LISTBOX_PaintItem( LB_DESCR *descr, HDC hdc, const RECT *rect,
-			       INT index, UINT action, BOOL ignoreFocus )
+			       UINT index, UINT action, BOOL ignoreFocus )
 {
     LB_ITEMDATA *item = NULL;
     if (index < descr->nb_items) item = &descr->items[index];
@@ -494,7 +494,7 @@ static void LISTBOX_PaintItem( LB_DESCR *descr, HDC hdc, const RECT *rect,
         RECT r;
         HRGN hrgn;
 
-	if (!item)
+	if (index >= descr->nb_items)
 	{
 	    if (action == ODA_FOCUS)
 		DrawFocusRect( hdc, rect );
-- 
2.19.1




More information about the wine-devel mailing list