Nikolay Sivov : comctl32/listview: Check columns array size before trying to obtain rectangle.

Alexandre Julliard julliard at winehq.org
Thu Apr 30 11:01:13 CDT 2009


Module: wine
Branch: master
Commit: 8a03ac58c59e787b6275704bb36a018eee1bb1c6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8a03ac58c59e787b6275704bb36a018eee1bb1c6

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Thu Apr 30 15:59:21 2009 +0400

comctl32/listview: Check columns array size before trying to obtain rectangle.

---

 dlls/comctl32/listview.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index bfe47a3..169c242 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -4156,11 +4156,11 @@ static void LISTVIEW_RefreshReportGrid(LISTVIEW_INFO *infoPtr, HDC hdc)
     INT rgntype;
     INT y, itemheight;
     HPEN hPen, hOldPen;
-    RECT rcClip, rcItem;
+    RECT rcClip, rcItem = {0};
     POINT Origin;
     RANGE colRange;
     ITERATOR j;
-    BOOL rmost;
+    BOOL rmost = FALSE;
 
     TRACE("()\n");
 
@@ -4183,8 +4183,11 @@ static void LISTVIEW_RefreshReportGrid(LISTVIEW_INFO *infoPtr, HDC hdc)
         if (rcItem.left + Origin.x < rcClip.right) break;
     }
     /* is right most vertical line visible? */
-    LISTVIEW_GetHeaderRect(infoPtr, DPA_GetPtrCount(infoPtr->hdpaColumns) - 1, &rcItem);
-    rmost = (rcItem.right + Origin.x < rcClip.right);
+    if (DPA_GetPtrCount(infoPtr->hdpaColumns) > 0)
+    {
+        LISTVIEW_GetHeaderRect(infoPtr, DPA_GetPtrCount(infoPtr->hdpaColumns) - 1, &rcItem);
+        rmost = (rcItem.right + Origin.x < rcClip.right);
+    }
 
     if ((hPen = CreatePen( PS_SOLID, 1, comctl32_color.clr3dFace )))
     {




More information about the wine-cvs mailing list