Commit e51b20bf authored by Markus Stockhausen's avatar Markus Stockhausen Committed by Alexandre Julliard

gdi32: Check for NULL pointer in GdiAlphaBlend.

parent 7471cfce
......@@ -518,9 +518,11 @@ BOOL WINAPI GdiAlphaBlend(HDC hdcDst, int xDst, int yDst, int widthDst, int heig
DC *dcDst, *dcSrc;
dcSrc = get_dc_ptr( hdcSrc );
if (!dcSrc) return FALSE;
if ((dcDst = get_dc_ptr( hdcDst )))
{
if (dcSrc) update_dc( dcSrc );
update_dc( dcSrc );
update_dc( dcDst );
TRACE("%p %d,%d %dx%d -> %p %d,%d %dx%d op=%02x flags=%02x srcconstalpha=%02x alphafmt=%02x\n",
hdcSrc, xSrc, ySrc, widthSrc, heightSrc,
......@@ -529,11 +531,11 @@ BOOL WINAPI GdiAlphaBlend(HDC hdcDst, int xDst, int yDst, int widthDst, int heig
blendFunction.SourceConstantAlpha, blendFunction.AlphaFormat);
if (dcDst->funcs->pAlphaBlend)
ret = dcDst->funcs->pAlphaBlend( dcDst->physDev, xDst, yDst, widthDst, heightDst,
dcSrc ? dcSrc->physDev : NULL,
xSrc, ySrc, widthSrc, heightSrc, blendFunction );
dcSrc->physDev, xSrc, ySrc, widthSrc, heightSrc,
blendFunction );
release_dc_ptr( dcDst );
}
if (dcSrc) release_dc_ptr( dcSrc );
release_dc_ptr( dcSrc );
return ret;
}
......
......@@ -2393,6 +2393,10 @@ static void test_GdiAlphaBlend(void)
expect_eq(pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, -1, 0, 30, 30, blend), TRUE, BOOL, "%d");
expect_eq(pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, 0, -1, 30, 30, blend), TRUE, BOOL, "%d");
SetLastError(0xdeadbeef);
expect_eq(pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, NULL, 0, 0, 20, 20, blend), FALSE, BOOL, "%d");
expect_eq(GetLastError(), 0xdeadbeef, int, "%d");
SelectObject(hdcDst, oldDst);
SelectObject(hdcSrc, oldSrc);
DeleteObject(bmpSrc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment