Kaydet (Commit) 3a00d7bb authored tarafından Caolán McNamara's avatar Caolán McNamara

forcepoint#67 detect cairo surface creation failure

if e.g. too large

Change-Id: I7de8748a5ed695c1b3ddc8c1358414f3acd68c94
Reviewed-on: https://gerrit.libreoffice.org/58453
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 22f60a3e
......@@ -1264,6 +1264,11 @@ void SvpSalGraphics::drawMask( const SalTwoRect& rTR,
/** creates an image from the given rectangle, replacing all black pixels
* with nMaskColor and make all other full transparent */
SourceHelper aSurface(rSalBitmap, true); // The mask is argb32
if (!aSurface.getSurface())
{
SAL_WARN("vcl.gdi", "unsupported SvpSalGraphics::drawMask case");
return;
}
sal_Int32 nStride;
unsigned char *mask_data = aSurface.getBits(nStride);
for (sal_Int32 y = rTR.mnSrcY ; y < rTR.mnSrcY + rTR.mnSrcHeight; ++y)
......@@ -1517,6 +1522,11 @@ cairo_surface_t* SvpSalGraphics::createCairoSurface(const BitmapBuffer *pBuffer)
nFormat,
pBuffer->mnWidth, pBuffer->mnHeight,
pBuffer->mnScanlineSize);
if (cairo_surface_status(target) != CAIRO_STATUS_SUCCESS)
{
cairo_surface_destroy(target);
return nullptr;
}
return target;
}
......
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