cursoricon.c Make sure bitmap file is actaully a bitmap file

Aric Stewart aric at codeweavers.com
Fri Apr 23 02:18:01 CDT 2004


Check to ensure that a file loaded with LoadImage is actually a bitmap 
file before believing the contents.

-------------- next part --------------
Index: windows/cursoricon.c
===================================================================
RCS file: /home/wine/wine/windows/cursoricon.c,v
retrieving revision 1.71
diff -u -w -r1.71 cursoricon.c
--- windows/cursoricon.c	12 Feb 2004 00:35:01 -0000	1.71
+++ windows/cursoricon.c	23 Apr 2004 03:10:15 -0000
@@ -2003,6 +2003,15 @@
     else
     {
         if (!(ptr = map_fileW( name ))) return 0;
+
+        /* we need to make sure this is a bitmap before we move on */
+        if (((BITMAPFILEHEADER*)ptr)->bfType != 0x4D42)
+        {
+            WARN("Not a bitmap file\n");
+            UnmapViewOfFile( ptr );
+            return 0;
+        }
+            
         info = (BITMAPINFO *)(ptr + sizeof(BITMAPFILEHEADER));
     }
     size = bitmap_info_size(info, DIB_RGB_COLORS);


More information about the wine-patches mailing list