Gerald Pfeifer : user32: Fix error handling in BITMAP_Load.

Alexandre Julliard julliard at winehq.org
Thu Dec 2 16:30:50 CST 2010


Module: wine
Branch: stable
Commit: 1ee3e39658fcbd5fdb3626677e53b95146dad106
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1ee3e39658fcbd5fdb3626677e53b95146dad106

Author: Gerald Pfeifer <gerald at pfeifer.com>
Date:   Sun Sep 19 16:10:39 2010 +0200

user32: Fix error handling in BITMAP_Load.
(cherry picked from commit 824ab969ff1c5e0e3706d37855f4652244e295d9)

---

 dlls/user32/cursoricon.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c
index 938f0dd..acae302 100644
--- a/dlls/user32/cursoricon.c
+++ b/dlls/user32/cursoricon.c
@@ -366,7 +366,7 @@ static BOOL is_dib_monochrome( const BITMAPINFO* info )
  *           DIB_GetBitmapInfo
  *
  * Get the info from a bitmap header.
- * Return 1 for INFOHEADER, 0 for COREHEADER,
+ * Return 1 for INFOHEADER, 0 for COREHEADER, -1 in case of failure.
  */
 static int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width,
                               LONG *height, WORD *bpp, DWORD *compr )
@@ -2257,6 +2257,12 @@ static HBITMAP BITMAP_Load( HINSTANCE instance, LPCWSTR name,
     memcpy(scaled_info, fix_info, size);
     bm_type = DIB_GetBitmapInfo( &fix_info->bmiHeader, &width, &height,
                                  &bpp_dummy, &compr_dummy);
+    if (bm_type == -1)
+    {
+        WARN("Invalid bitmap format!\n");
+        goto end_close;
+    }
+
     if(desiredx != 0)
         new_width = desiredx;
     else




More information about the wine-cvs mailing list