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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Jan 12 14:40:51 UTC 2020


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

New commits:
commit 3cd738d52ec2adf78f97b1e88b47dec4e5e16f74
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Jan 11 20:37:17 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Jan 12 15:40:17 2020 +0100

    ofz#20031 Abrt
    
    Change-Id: I54451cdda29b9683fc8adf8374cb611bbebf0097
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86627
    Tested-by: Jenkins
    Reviewed-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 e6e4d60da426..e99349c1684d 100644
--- a/filter/source/graphicfilter/icgm/bitmap.cxx
+++ b/filter/source/graphicfilter/icgm/bitmap.cxx
@@ -70,9 +70,17 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
 {
     rDesc.mbStatus = true;
 
-    if (!(ImplGetDimensions(rDesc) && rDesc.mpBuf && isLegalBitsPerPixel(rDesc.mnDstBitsPerPixel)))
+    if (!ImplGetDimensions(rDesc) || !rDesc.mpBuf)
         return;
 
+    if (!isLegalBitsPerPixel(rDesc.mnDstBitsPerPixel))
+    {
+        rDesc.mbStatus = false;
+        return;
+    }
+
+    try {
+
     vcl::bitmap::RawBitmap aBitmap( Size( rDesc.mnX, rDesc.mnY ), 24 );
 
     // the picture may either be read from left to right or right to left, from top to bottom ...
@@ -247,6 +255,10 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
 
     if ( rDesc.mbStatus )
         rDesc.mxBitmap = vcl::bitmap::CreateFromData(std::move(aBitmap));
+
+    } catch (const std::bad_alloc&) {
+        rDesc.mbStatus = false;
+    }
 }
 
 std::vector<Color> CGMBitmap::ImplGeneratePalette( CGMBitmapDescriptor const & rDesc )


More information about the Libreoffice-commits mailing list