Alexandre Julliard : gdi32: Check that the bitmap depth matches the DC when selecting it.

Alexandre Julliard julliard at winehq.org
Fri May 25 10:52:48 CDT 2012


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri May 25 11:19:36 2012 +0200

gdi32: Check that the bitmap depth matches the DC when selecting it.

---

 dlls/gdi32/bitmap.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/dlls/gdi32/bitmap.c b/dlls/gdi32/bitmap.c
index b46521a..1a0e6bb 100644
--- a/dlls/gdi32/bitmap.c
+++ b/dlls/gdi32/bitmap.c
@@ -507,6 +507,15 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
         goto done;
     }
 
+    if (bitmap->dib.dsBm.bmBitsPixel != 1 &&
+        bitmap->dib.dsBm.bmBitsPixel != GetDeviceCaps( hdc, BITSPIXEL ))
+    {
+        WARN( "Wrong format bitmap %u bpp\n", bitmap->dib.dsBm.bmBitsPixel );
+        GDI_ReleaseObj( handle );
+        ret = 0;
+        goto done;
+    }
+
     if (dc->dibdrv) old_physdev = pop_dc_driver( dc, dc->dibdrv );
 
     physdev = GET_DC_PHYSDEV( dc, pSelectBitmap );




More information about the wine-cvs mailing list