From 453d1d907700a58e1b8024af7114e17a60e430b3 Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Tue, 7 Jul 2009 16:58:36 +0000 Subject: [PATCH] AlphaBlend: - Return immediately if any bitmap size is smaller than zero - Also check calculated input bitmap size against source size - Remove outdated FIXME - Fixes three gdi32 bitmap winetests svn path=/trunk/; revision=41800 --- reactos/subsystems/win32/win32k/eng/alphablend.c | 9 +++------ reactos/subsystems/win32/win32k/objects/bitblt.c | 6 ++++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/reactos/subsystems/win32/win32k/eng/alphablend.c b/reactos/subsystems/win32/win32k/eng/alphablend.c index 7ccab538e12..30ba88fd386 100644 --- a/reactos/subsystems/win32/win32k/eng/alphablend.c +++ b/reactos/subsystems/win32/win32k/eng/alphablend.c @@ -54,7 +54,6 @@ EngAlphaBlend(IN SURFOBJ *psoDest, BlendObj->BlendFunction.BlendFlags, BlendObj->BlendFunction.SourceConstantAlpha, BlendObj->BlendFunction.AlphaFormat); - /* Validate output */ OutputRect = *DestRect; if (OutputRect.right < OutputRect.left) @@ -68,14 +67,12 @@ EngAlphaBlend(IN SURFOBJ *psoDest, OutputRect.right = DestRect->left; } - /* Validate input */ - - /* FIXME when WindowOrg.x or .y are negitve this check are not vaild, - * we need convert the inputRect to the windows org and do it right */ InputRect = *SourceRect; if ( (InputRect.top < 0) || (InputRect.bottom < 0) || - (InputRect.left < 0) || (InputRect.right < 0) ) + (InputRect.left < 0) || (InputRect.right < 0) || + InputRect.right > psoSource->sizlBitmap.cx || + InputRect.bottom > psoSource->sizlBitmap.cy ) { SetLastWin32Error(ERROR_INVALID_PARAMETER); return FALSE; diff --git a/reactos/subsystems/win32/win32k/objects/bitblt.c b/reactos/subsystems/win32/win32k/objects/bitblt.c index fe5d994efa0..29159a35d6e 100644 --- a/reactos/subsystems/win32/win32k/objects/bitblt.c +++ b/reactos/subsystems/win32/win32k/objects/bitblt.c @@ -49,6 +49,12 @@ NtGdiAlphaBlend( BLENDOBJ BlendObj; BlendObj.BlendFunction = BlendFunc; + if (WidthDest < 0 || HeightDest < 0 || WidthSrc < 0 || HeightSrc < 0) + { + SetLastWin32Error(ERROR_INVALID_PARAMETER); + return FALSE; + } + DCDest = DC_LockDc(hDCDest); if (NULL == DCDest) {