[Libreoffice-commits] core.git: vcl/source

Caolán McNamara caolanm at redhat.com
Tue Jun 12 20:06:08 UTC 2018


 vcl/source/bitmap/BitmapScaleSuperFilter.cxx |    7 +++++++
 vcl/source/gdi/gdimtf.cxx                    |    4 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 2927c7785d6bf6cef3f4bcc0bc3e463ac6a55b01
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 12 14:21:12 2018 +0100

    crashtesting: asserts on inability to scale oversize graphics
    
    since...
    
    commit d46c32140fdb05758c039dd27552b1788faac104
    Date:   Thu Jun 7 12:37:33 2018 +0200
    
        assert in BitmapInfoAccess if bitmap is empty or we can't read from it
    
    Change-Id: I138a53e9ce0763d4e62cfbba594abb323e807378
    Reviewed-on: https://gerrit.libreoffice.org/55704
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/bitmap/BitmapScaleSuperFilter.cxx b/vcl/source/bitmap/BitmapScaleSuperFilter.cxx
index 2bea98bcbb29..f096bd7429ff 100644
--- a/vcl/source/bitmap/BitmapScaleSuperFilter.cxx
+++ b/vcl/source/bitmap/BitmapScaleSuperFilter.cxx
@@ -950,10 +950,17 @@ BitmapEx BitmapScaleSuperFilter::execute(BitmapEx const& rBitmap)
 
     if (nDstW <= 1 || nDstH <= 1)
         return BitmapEx();
+
     {
         Bitmap::ScopedReadAccess pReadAccess(aBitmap);
 
         Bitmap aOutBmp(Size(nDstW, nDstH), 24);
+        Size aOutSize = aOutBmp.GetSizePixel();
+        if (!aOutSize.Width() || !aOutSize.Height())
+        {
+            SAL_WARN("vcl.gdi", "bmp creation failed");
+            return BitmapEx();
+        }
 
         BitmapScopedWriteAccess pWriteAccess(aOutBmp);
 
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index d0dded107ed3..aee51fb98b99 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -2818,7 +2818,9 @@ bool GDIMetaFile::CreateThumbnail(BitmapEx& rBitmapEx, BmpConversion eColorConve
         aBitmap.Scale(aDrawSize, nScaleFlag);
 
         // convert to desired bitmap color format
-        aBitmap.Convert(eColorConversion);
+        Size aSize(aBitmap.GetSizePixel());
+        if (aSize.Width() && aSize.Height())
+            aBitmap.Convert(eColorConversion);
 
         rBitmapEx = BitmapEx(aBitmap);
     }


More information about the Libreoffice-commits mailing list