[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - vcl/source

Caolán McNamara caolanm at redhat.com
Mon Nov 6 15:11:21 UTC 2017


 vcl/source/gdi/pngread.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 4428c662765464e7f461101887f0141fde4ba4ef
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Nov 6 09:55:42 2017 +0000

    ofz#4076 bad palette READ
    
    Change-Id: I54943d96baa6e2309bbf2cd3b6d8bcada2b76952
    Reviewed-on: https://gerrit.libreoffice.org/44353
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index 40d4085f56ff..62172d12a8c5 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -123,6 +123,7 @@ private:
     bool                mbGrayScale : 1;
     bool                mbzCodecInUse : 1;
     bool                mbStatus : 1;
+    bool                mbIDATStarted : 1;  // true if IDAT seen
     bool                mbIDAT : 1;         // true if finished with enough IDAT chunks
     bool                mbGamma : 1;        // true if Gamma Correction available
     bool                mbpHYs : 1;         // true if physical size of pixel available
@@ -201,6 +202,7 @@ PNGReaderImpl::PNGReaderImpl( SvStream& rPNGStream )
     mbGrayScale( false ),
     mbzCodecInUse   ( false ),
     mbStatus( true ),
+    mbIDATStarted( false ),
     mbIDAT( false ),
     mbGamma             ( false ),
     mbpHYs              ( false ),
@@ -364,7 +366,7 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& rPreviewSizeHint )
 
             case PNGCHUNK_PLTE :
             {
-                if ( !mbPalette )
+                if (!mbPalette && !mbIDATStarted)
                     mbStatus = ImplReadPalette();
             }
             break;
@@ -483,7 +485,7 @@ bool PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint )
     }
 
     mbPalette = true;
-    mbIDAT = mbAlphaChannel = mbTransparent = false;
+    mbIDATStarted = mbIDAT = mbAlphaChannel = mbTransparent = false;
     mbGrayScale = mbRGBTriple = false;
     mnTargetDepth = mnPngDepth;
     sal_uInt64 nScansize64 = ( ( static_cast< sal_uInt64 >( maOrigSize.Width() ) * mnPngDepth ) + 7 ) >> 3;
@@ -898,6 +900,8 @@ void PNGReaderImpl::ImplReadIDAT()
 {
     if( mnChunkLen > 0 )
     {
+        mbIDATStarted = true;
+
         if ( !mbzCodecInUse )
         {
             mbzCodecInUse = true;


More information about the Libreoffice-commits mailing list