diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-08-01 21:34:20 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2020-06-23 16:08:16 +0200 |
commit | 02dfcab214f0c1778007fc1e30d4c49066f7f7e9 (patch) | |
tree | 7fb07d7bac8d583650c90341e45eccb5f5af7632 | |
parent | 0b2a5f917a5201707e114ba7aae95c09ab51fabe (diff) |
forcepoint#67 detect cairo surface creation failure
if e.g. too large
Reviewed-on: https://gerrit.libreoffice.org/58454
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
(cherry picked from commit 36bee88834f90818c5475b460c729186ef6c9229)
Change-Id: I7de8748a5ed695c1b3ddc8c1358414f3acd68c94
-rw-r--r-- | vcl/headless/svpgdi.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index a49080c18249..f7f6aa3ff557 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -1269,6 +1269,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) @@ -1586,6 +1591,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; } |