[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - vcl/headless

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Aug 3 09:12:44 UTC 2018


 vcl/headless/svpgdi.cxx |   10 ++++++++++
 1 file changed, 10 insertions(+)

New commits:
commit 36bee88834f90818c5475b460c729186ef6c9229
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Aug 1 21:34:20 2018 +0100
Commit:     Michael Stahl <Michael.Stahl at cib.de>
CommitDate: Fri Aug 3 11:12:19 2018 +0200

    forcepoint#67 detect cairo surface creation failure
    
    if e.g. too large
    
    Change-Id: I7de8748a5ed695c1b3ddc8c1358414f3acd68c94
    Reviewed-on: https://gerrit.libreoffice.org/58454
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>

diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 9a3e9247659c..f4ef3b21fe33 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -1228,6 +1228,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)
@@ -1482,6 +1487,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;
 }
 


More information about the Libreoffice-commits mailing list