From c67f075d67a6d8de19dae570022265fc0f89ef52 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Thu, 24 Feb 2011 22:12:09 +0100 Subject: [PATCH] user32: Check bitmap info before it is used. --- dlls/user32/cursoricon.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index 2c9aeef494..cd7d3eda50 100644 --- a/dlls/user32/cursoricon.c +++ b/dlls/user32/cursoricon.c @@ -2198,6 +2198,14 @@ static HBITMAP BITMAP_Load( HINSTANCE instance, LPCWSTR name, if (bmfh->bfOffBits) offbits = bmfh->bfOffBits - sizeof(BITMAPFILEHEADER); } + bm_type = DIB_GetBitmapInfo( &info->bmiHeader, &width, &height, + &bpp_dummy, &compr_dummy); + if (bm_type == -1) + { + WARN("Invalid bitmap format!\n"); + goto end; + } + size = bitmap_info_size(info, DIB_RGB_COLORS); fix_info = HeapAlloc(GetProcessHeap(), 0, size); scaled_info = HeapAlloc(GetProcessHeap(), 0, size); @@ -2209,13 +2217,6 @@ static HBITMAP BITMAP_Load( HINSTANCE instance, LPCWSTR name, DIB_FixColorsToLoadflags(fix_info, loadflags, pix); 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; - } if(desiredx != 0) new_width = desiredx; -- 2.32.0.93.g670b81a890