summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-11-06 09:55:42 +0000
committerAndras Timar <andras.timar@collabora.com>2017-11-27 12:55:07 +0100
commit1e8d8b4fafdda72bafc87ad43a815050f245905a (patch)
tree8e803228c09401d8d37b74491cbb67c20ac9fbbb /vcl
parent43a596299257a379bdae7dd16f7f6b03f4c89446 (diff)
ofz#4076 bad palette READ
Change-Id: I54943d96baa6e2309bbf2cd3b6d8bcada2b76952 Reviewed-on: https://gerrit.libreoffice.org/44353 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com> (cherry picked from commit 4428c662765464e7f461101887f0141fde4ba4ef)
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/pngread.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index 09aae8998cc9..7ad8aed88111 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -118,6 +118,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
@@ -200,6 +201,7 @@ PNGReaderImpl::PNGReaderImpl( SvStream& rPNGStream )
mbGrayScale( false ),
mbzCodecInUse ( false ),
mbStatus( true ),
+ mbIDATStarted( false ),
mbIDAT( false ),
mbGamma ( false ),
mbpHYs ( false ),
@@ -368,7 +370,7 @@ BitmapEx PNGReaderImpl::GetBitmapEx( const Size& rPreviewSizeHint )
case PNGCHUNK_PLTE :
{
- if ( !mbPalette )
+ if (!mbPalette && !mbIDATStarted)
mbStatus = ImplReadPalette();
}
break;
@@ -498,7 +500,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;
@@ -899,6 +901,8 @@ void PNGReaderImpl::ImplReadIDAT()
{
if( mnChunkLen > 0 )
{
+ mbIDATStarted = true;
+
if ( !mbzCodecInUse )
{
mbzCodecInUse = true;