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

Caolán McNamara caolanm at redhat.com
Mon Oct 9 13:52:59 UTC 2017


 filter/source/graphicfilter/icgm/bitmap.cxx |   21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

New commits:
commit bd9cf89f6dc13da314d0dd6fc43512a8732ce125
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Oct 9 12:49:58 2017 +0100

    ofz#3587 ignore broken cgm images
    
    Change-Id: I649ace9e3e5cc008ba09fcc72f9c9b79322d39ab
    Reviewed-on: https://gerrit.libreoffice.org/43277
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/filter/source/graphicfilter/icgm/bitmap.cxx b/filter/source/graphicfilter/icgm/bitmap.cxx
index 86e70007e3ac..7208fda0ae97 100644
--- a/filter/source/graphicfilter/icgm/bitmap.cxx
+++ b/filter/source/graphicfilter/icgm/bitmap.cxx
@@ -33,12 +33,31 @@ CGMBitmap::~CGMBitmap()
 {
 }
 
+namespace
+{
+    bool isLegalBitsPerPixel(sal_uInt32 nBitsPerPixel)
+    {
+        switch (nBitsPerPixel)
+        {
+            case 1:
+            case 2:
+            case 4:
+            case 8:
+            case 24:
+                return true;
+                break;
+            default:
+                break;
+        }
+        return false;
+    }
+}
 
 void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
 {
     rDesc.mbStatus = true;
 
-    if ( ImplGetDimensions( rDesc ) && rDesc.mpBuf )
+    if (ImplGetDimensions(rDesc) && rDesc.mpBuf && isLegalBitsPerPixel(rDesc.mnDstBitsPerPixel))
     {
         rDesc.mpBitmap = new Bitmap( Size( rDesc.mnX, rDesc.mnY ), (sal_uInt16)rDesc.mnDstBitsPerPixel );
         if ( ( rDesc.mpAcc = rDesc.mpBitmap->AcquireWriteAccess() ) != nullptr )


More information about the Libreoffice-commits mailing list