vcl/qa/cppunit/graphicfilter/data/wmf/fail/bitcount-1.wmf |binary
 vcl/source/gdi/dibtools.cxx                               |   14 +++++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit 6f8a09eef9abbf250798122f2c22e35adac1b90d
Author: Caolán McNamara <caol...@redhat.com>
Date:   Mon Sep 28 09:35:23 2015 +0100

    wmf spec says that these are only allowed bitcount values
    
    Change-Id: Ia174feec73ee676567a3632d2f88b11c176b6363
    (cherry picked from commit b107353addfe35cc40864b7fb5ff4fee42fff6cf)
    Reviewed-on: https://gerrit.libreoffice.org/18903
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>
    Tested-by: Miklos Vajna <vmik...@collabora.co.uk>

diff --git a/vcl/qa/cppunit/graphicfilter/data/wmf/fail/bitcount-1.wmf 
b/vcl/qa/cppunit/graphicfilter/data/wmf/fail/bitcount-1.wmf
new file mode 100644
index 0000000..2ec8806
Binary files /dev/null and 
b/vcl/qa/cppunit/graphicfilter/data/wmf/fail/bitcount-1.wmf differ
diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx
index 247ce7c..a018beb 100644
--- a/vcl/source/gdi/dibtools.cxx
+++ b/vcl/source/gdi/dibtools.cxx
@@ -276,7 +276,19 @@ bool ImplReadDIBInfoHeader(SvStream& rIStm, DIBV5Header& 
rHeader, bool& bTopDown
         rHeader.nSizeImage = 0;
     }
 
-    return( ( rHeader.nPlanes == 1 ) && ( rIStm.GetError() == 0UL ) );
+
+    if (rHeader.nPlanes != 1)
+        return false;
+
+    if (rHeader.nBitCount != 0 && rHeader.nBitCount != 1 &&
+        rHeader.nBitCount != 4 && rHeader.nBitCount != 8 &&
+        rHeader.nBitCount != 16 && rHeader.nBitCount != 24 &&
+        rHeader.nBitCount != 32)
+    {
+        return false;
+    }
+
+    return rIStm.good();
 }
 
 bool ImplReadDIBPalette( SvStream& rIStm, BitmapWriteAccess& rAcc, bool bQuad )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to