diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c index e8e2c887950..9f37ab08d9f 100644 --- a/dlls/gdi32/bitblt.c +++ b/dlls/gdi32/bitblt.c @@ -669,7 +669,23 @@ BOOL WINAPI GdiAlphaBlend(HDC hdcDst, int xDst, int yDst, int widthDst, int heig blendFunction.BlendOp, blendFunction.BlendFlags, blendFunction.SourceConstantAlpha, blendFunction.AlphaFormat ); - if (!ret) ret = dst_dev->funcs->pAlphaBlend( dst_dev, &dst, src_dev, &src, blendFunction ); + if (src.x < 0 || src.y < 0 || src.width < 0 || src.height < 0 || + (dcSrc->header.type == OBJ_MEMDC && + (src.width > dcSrc->vis_rect.right - dcSrc->vis_rect.left - src.x || + src.height > dcSrc->vis_rect.bottom - dcSrc->vis_rect.top - src.y))) + { + WARN( "Invalid src coords: (%d,%d), size %dx%d\n", src.x, src.y, src.width, src.height ); + SetLastError( ERROR_INVALID_PARAMETER ); + ret = FALSE; + } + else if (dst.width < 0 || dst.height < 0) + { + WARN( "Invalid dst coords: (%d,%d), size %dx%d\n", dst.x, dst.y, dst.width, dst.height ); + SetLastError( ERROR_INVALID_PARAMETER ); + ret = FALSE; + } + else if (!ret) ret = dst_dev->funcs->pAlphaBlend( dst_dev, &dst, src_dev, &src, blendFunction ); + release_dc_ptr( dcDst ); } release_dc_ptr( dcSrc ); diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c index 62fba775e5b..2e7aca36d86 100644 --- a/dlls/winex11.drv/xrender.c +++ b/dlls/winex11.drv/xrender.c @@ -2396,22 +2396,13 @@ static BOOL xrenderdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst, double xscale, yscale; BOOL use_repeat; - if (src->x < 0 || src->y < 0 || src->width < 0 || src->height < 0 || - src->width > physdev_src->x11dev->drawable_rect.right - physdev_src->x11dev->drawable_rect.left - src->x || - src->height > physdev_src->x11dev->drawable_rect.bottom - physdev_src->x11dev->drawable_rect.top - src->y) - { - WARN( "Invalid src coords: (%d,%d), size %dx%d\n", src->x, src->y, src->width, src->height ); - SetLastError( ERROR_INVALID_PARAMETER ); - return FALSE; - } - if (!X11DRV_XRender_Installed || src_dev->funcs != dst_dev->funcs) { dst_dev = GET_NEXT_PHYSDEV( dst_dev, pAlphaBlend ); return dst_dev->funcs->pAlphaBlend( dst_dev, dst, src_dev, src, blendfn ); } - if (physdev_src->x11dev != physdev_dst->x11dev) X11DRV_LockDIBSection( physdev_src->x11dev, DIB_Status_GdiMod ); + if (physdev_src != physdev_dst) X11DRV_LockDIBSection( physdev_src->x11dev, DIB_Status_GdiMod ); X11DRV_LockDIBSection( physdev_dst->x11dev, DIB_Status_GdiMod ); dst_pict = get_xrender_picture( physdev_dst->x11dev ); @@ -2460,7 +2451,7 @@ static BOOL xrenderdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords *dst, wine_tsx11_unlock(); LeaveCriticalSection( &xrender_cs ); - if (physdev_src->x11dev != physdev_dst->x11dev) X11DRV_UnlockDIBSection( physdev_src->x11dev, FALSE ); + if (physdev_src != physdev_dst) X11DRV_UnlockDIBSection( physdev_src->x11dev, FALSE ); X11DRV_UnlockDIBSection( physdev_dst->x11dev, TRUE ); return TRUE; }