Lei Zhang : gdi32: Prevent integer overflow in CreateBitmapIndirect.
Alexandre Julliard
julliard at winehq.org
Wed Dec 17 09:39:34 CST 2008
Module: wine
Branch: master
Commit: 6d790d6ed0af3b26f20de24bb09747356b9d2b80
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6d790d6ed0af3b26f20de24bb09747356b9d2b80
Author: Lei Zhang <thestig at google.com>
Date: Tue Dec 16 18:24:29 2008 -0800
gdi32: Prevent integer overflow in CreateBitmapIndirect.
---
dlls/gdi32/bitmap.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dlls/gdi32/bitmap.c b/dlls/gdi32/bitmap.c
index e7370a2..2a083c5 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;
More information about the wine-cvs
mailing list