Signed-off-by: Vincent Povirk vincent@codeweavers.com --- dlls/gdi32/enhmetafile.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/dlls/gdi32/enhmetafile.c b/dlls/gdi32/enhmetafile.c index d8f72c98718..c66e382c1d6 100644 --- a/dlls/gdi32/enhmetafile.c +++ b/dlls/gdi32/enhmetafile.c @@ -2559,12 +2559,26 @@ BOOL WINAPI PlayEnhMetaFileRecord( HBITMAP hBmp = 0, hBmpOld = 0; const BITMAPINFO *pbi = (const BITMAPINFO *)((const BYTE *)mr + pAlphaBlend->offBmiSrc); void *bits; + DIBSECTION dib;
SetGraphicsMode(hdcSrc, GM_ADVANCED); SetWorldTransform(hdcSrc, &pAlphaBlend->xformSrc);
hBmp = CreateDIBSection(hdc, pbi, pAlphaBlend->iUsageSrc, &bits, NULL, 0); - memcpy(bits, (const BYTE *)mr + pAlphaBlend->offBitsSrc, pAlphaBlend->cbBitsSrc); + if (!hBmp) + { + WARN("EMR_ALPHABLEND: couldn't create DIB section\n"); + return FALSE; + } + + if (!GetObjectW(hBmp, sizeof(dib), &dib)) + { + ERR("EMR_ALPHABLEND: couldn't get DIB object\n"); + DeleteObject(hBmp); + return FALSE; + } + + memcpy(bits, (const BYTE *)mr + pAlphaBlend->offBitsSrc, min(pAlphaBlend->cbBitsSrc, dib.dsBmih.biSizeImage)); hBmpOld = SelectObject(hdcSrc, hBmp);
GdiAlphaBlend(hdc, pAlphaBlend->xDest, pAlphaBlend->yDest, pAlphaBlend->cxDest, pAlphaBlend->cyDest,