gdi32: Check header pointer in CreateDIBitmap.

This commit is contained in:
Nikolay Sivov 2009-05-03 12:42:00 +04:00 committed by Alexandre Julliard
parent 1b1e0027db
commit 0f9bc1d3b7
2 changed files with 8 additions and 1 deletions

View File

@ -1097,6 +1097,8 @@ HBITMAP WINAPI CreateDIBitmap( HDC hdc, const BITMAPINFOHEADER *header,
DWORD compr, size;
DC *dc;
if (!header) return 0;
if (DIB_GetBitmapInfo( header, &width, &height, &planes, &bpp, &compr, &size ) == -1) return 0;
if (width < 0)

View File

@ -144,7 +144,12 @@ static void test_createdibitmap(void)
bmih.biPlanes = 1;
bmih.biBitCount = 32;
bmih.biCompression = BI_RGB;
hbm = CreateDIBitmap(hdc, NULL, CBM_INIT, NULL, NULL, 0);
ok(hbm == NULL, "CreateDIBitmap should fail\n");
hbm = CreateDIBitmap(hdc, NULL, 0, NULL, NULL, 0);
ok(hbm == NULL, "CreateDIBitmap should fail\n");
/* First create an un-initialised bitmap. The depth of the bitmap
should match that of the hdc and not that supplied in bmih.
*/