[PATCH 7/7] Fail to create imagelist with zero or negative image dimensions

Nikolay Sivov nsivov at codeweavers.com
Thu Aug 19 01:20:11 CDT 2010


---
 dlls/comctl32/imagelist.c       |    2 ++
 dlls/comctl32/tests/imagelist.c |    3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c
index 6fee577..2218d99 100644
--- a/dlls/comctl32/imagelist.c
+++ b/dlls/comctl32/imagelist.c
@@ -694,6 +694,8 @@ ImageList_Create (INT cx, INT cy, UINT flags,
 
     TRACE("(%d %d 0x%x %d %d)\n", cx, cy, flags, cInitial, cGrow);
 
+    if (cx <= 0 || cy <= 0) return NULL;
+
     /* Create the IImageList interface for the image list */
     if (FAILED(ImageListImpl_CreateInstance(NULL, &IID_IImageList, (void **)&himl)))
         return NULL;
diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c
index d4699bc..26c7e12 100644
--- a/dlls/comctl32/tests/imagelist.c
+++ b/dlls/comctl32/tests/imagelist.c
@@ -1754,7 +1754,6 @@ static void test_create(void)
 {
     HIMAGELIST himl;
 
-todo_wine {
     /* list with zero or negative image dimensions */
     himl = ImageList_Create(0, 0, ILC_COLOR16, 0, 3);
     ok(himl == NULL, "got %p\n", himl);
@@ -1772,8 +1771,6 @@ todo_wine {
     ok(himl == NULL, "got %p\n", himl);
 }
 
-}
-
 START_TEST(imagelist)
 {
     ULONG_PTR ctx_cookie;
-- 
1.5.6.5



--------------010207030706000807070400--



More information about the wine-patches mailing list