From 6d790d6ed0af3b26f20de24bb09747356b9d2b80 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 16 Dec 2008 18:24:29 -0800 Subject: [PATCH] gdi32: Prevent integer overflow in CreateBitmapIndirect. --- dlls/gdi32/bitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/gdi32/bitmap.c b/dlls/gdi32/bitmap.c index e7370a24650..2a083c50591 100644 --- a/dlls/gdi32/bitmap.c +++ b/dlls/gdi32/bitmap.c @@ -274,7 +274,7 @@ HBITMAP WINAPI CreateBitmapIndirect( const BITMAP *bmp ) /* Windows ignores the provided bm.bmWidthBytes */ bm.bmWidthBytes = BITMAP_GetWidthBytes( bm.bmWidth, bm.bmBitsPixel ); /* XP doesn't allow to create bitmaps larger than 128 Mb */ - if (bm.bmHeight * bm.bmWidthBytes > 128 * 1024 * 1024) + if (bm.bmHeight > 128 * 1024 * 1024 / bm.bmWidthBytes) { SetLastError( ERROR_NOT_ENOUGH_MEMORY ); return 0;