gdi32: Prevent integer overflow in CreateBitmapIndirect.

This commit is contained in:
Lei Zhang 2008-12-16 18:24:29 -08:00 committed by Alexandre Julliard
parent e742dbb722
commit 6d790d6ed0
1 changed files with 1 additions and 1 deletions

View File

@ -274,7 +274,7 @@ HBITMAP WINAPI CreateBitmapIndirect( const BITMAP *bmp )
/* Windows ignores the provided bm.bmWidthBytes */ /* Windows ignores the provided bm.bmWidthBytes */
bm.bmWidthBytes = BITMAP_GetWidthBytes( bm.bmWidth, bm.bmBitsPixel ); bm.bmWidthBytes = BITMAP_GetWidthBytes( bm.bmWidth, bm.bmBitsPixel );
/* XP doesn't allow to create bitmaps larger than 128 Mb */ /* 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 ); SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return 0; return 0;