[PATCH] user32: handle unknown bit depths (Coverity)

Marcus Meissner marcus at jet.franken.de
Tue Dec 29 16:50:35 CST 2009


Hi,

Handling of -1 returns from get_bitmap_width_bytes(),
for unknown bitspixels.

Ciao, Marcus
---
 dlls/user32/cursoricon.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c
index 188500a..6929e2d 100644
--- a/dlls/user32/cursoricon.c
+++ b/dlls/user32/cursoricon.c
@@ -1943,6 +1943,11 @@ HICON WINAPI CreateIconIndirect(PICONINFO iconinfo)
         /* we can use either depth 1 or screen depth for xor bitmap */
         if (bmpXor.dsBm.bmPlanes == 1 && bmpXor.dsBm.bmBitsPixel == 1) planes = bpp = 1;
         sizeXor = bmpXor.dsBm.bmHeight * planes * get_bitmap_width_bytes( bmpXor.dsBm.bmWidth, bpp );
+        if (-1 == get_bitmap_width_bytes( bmpXor.dsBm.bmWidth, bpp ))
+        {
+           FIXME("unknown bitmap depth %d\n", bpp);
+           return 0;
+        }
     }
     GetObjectW( iconinfo->hbmMask, sizeof(bmpAnd), &bmpAnd );
     TRACE("mask: width %d, height %d, width bytes %d, planes %u, bpp %u\n",
-- 
1.5.6



More information about the wine-patches mailing list