Nikolay Sivov : comctl32/listview: Exit early on LVM_CREATEDRAGIMAGE if null pointer passed for a point.

Alexandre Julliard julliard at winehq.org
Tue Apr 20 11:32:22 CDT 2010


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Apr 20 02:23:28 2010 +0400

comctl32/listview: Exit early on LVM_CREATEDRAGIMAGE if null pointer passed for a point.

---

 dlls/comctl32/listview.c       |    2 +-
 dlls/comctl32/tests/listview.c |   23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 642a8aa..9ca52c5 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -5209,7 +5209,7 @@ static HIMAGELIST LISTVIEW_CreateDragImage(LISTVIEW_INFO *infoPtr, INT iItem, LP
     HIMAGELIST dragList = 0;
     TRACE("iItem=%d Count=%d\n", iItem, infoPtr->nItemCount);
 
-    if (iItem < 0 || iItem >= infoPtr->nItemCount)
+    if (iItem < 0 || iItem >= infoPtr->nItemCount || !lppt)
         return 0;
 
     rcItem.left = LVIR_BOUNDS;
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 59c3dc1..2c5ef70 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -4344,6 +4344,28 @@ static void test_header_notification(void)
     DestroyWindow(list);
 }
 
+static void test_createdragimage(void)
+{
+    HIMAGELIST himl;
+    POINT pt;
+    HWND list;
+
+    list = create_listview_control(LVS_ICON);
+    ok(list != 0, "failed to create listview window\n");
+
+    insert_item(list, 0);
+
+    /* NULL point */
+    himl = (HIMAGELIST)SendMessageA(list, LVM_CREATEDRAGIMAGE, 0, 0);
+    ok(himl == NULL, "got %p\n", himl);
+
+    himl = (HIMAGELIST)SendMessageA(list, LVM_CREATEDRAGIMAGE, 0, (LPARAM)&pt);
+    ok(himl != NULL, "got %p\n", himl);
+    ImageList_Destroy(himl);
+
+    DestroyWindow(list);
+}
+
 START_TEST(listview)
 {
     HMODULE hComctl32;
@@ -4406,6 +4428,7 @@ START_TEST(listview)
     test_finditem();
     test_hover();
     test_destroynotify();
+    test_createdragimage();
 
     if (!load_v6_module(&ctx_cookie, &hCtx))
     {




More information about the wine-cvs mailing list