Image List can be created with a width of zero

Mike Hearn mike at theoretic.com
Thu Aug 28 17:13:43 CDT 2003


ChangeLog:
Avoid division by zero when the imagelist is created with a width of
zero (ie no images)

Index: dlls/comctl32/imagelist.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/imagelist.c,v
retrieving revision 1.74
diff -u -r1.74 imagelist.c
--- dlls/comctl32/imagelist.c	13 May 2003 03:36:27 -0000	1.74
+++ dlls/comctl32/imagelist.c	28 Aug 2003 22:09:39 -0000
@@ -284,7 +284,10 @@
     if (!GetObjectA (hBitmap, sizeof(BITMAP), &bmp))
         return -1;
 
-    nImageCount = bmp.bmWidth / himl->cx;
+    if (himl->cx > 0)
+	nImageCount = bmp.bmWidth / himl->cx;
+    else
+	nImageCount = 0;
 
     IMAGELIST_InternalExpandBitmaps (himl, nImageCount, bmp.bmWidth, bmp.bmHeight);
 





More information about the wine-patches mailing list