Author: hdu
Date: Wed May  9 09:28:41 2012
New Revision: 1336023

URL: http://svn.apache.org/viewvc?rev=1336023&view=rev
Log:
ensure PNG header chunks uniqueness

Modified:
    incubator/ooo/trunk/main/vcl/source/gdi/pngread.cxx

Modified: incubator/ooo/trunk/main/vcl/source/gdi/pngread.cxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/vcl/source/gdi/pngread.cxx?rev=1336023&r1=1336022&r2=1336023&view=diff
==============================================================================
--- incubator/ooo/trunk/main/vcl/source/gdi/pngread.cxx (original)
+++ incubator/ooo/trunk/main/vcl/source/gdi/pngread.cxx Wed May  9 09:28:41 2012
@@ -197,6 +197,8 @@ PNGReaderImpl::PNGReaderImpl( SvStream& 
        mpScanPrior     ( NULL ),
        mpTransTab              ( NULL ),
        mpColorTable    ( (sal_uInt8*) mpDefaultColorTable ),
+       mnColorType( 0xFF ),
+       mbPalette( false ),
        mbzCodecInUse   ( sal_False ),
     mbStatus( sal_True),
     mbIDAT( sal_False ),
@@ -366,6 +368,10 @@ BitmapEx PNGReaderImpl::GetBitmapEx( con
     // reset to the first chunk
     maChunkIter = maChunkSeq.begin();
 
+    // read the first chunk which must be the IHDR chunk
+    ReadNextChunk();
+    mbStatus = (mnChunkType == PNGCHUNK_IHDR) && ImplReadHeader( 
rPreviewSizeHint );
+
     // parse the chunks
     while( mbStatus && !mbIDAT && ReadNextChunk() )
     {
@@ -373,7 +379,7 @@ BitmapEx PNGReaderImpl::GetBitmapEx( con
                {
                        case PNGCHUNK_IHDR :
                        {
-                               mbStatus = ImplReadHeader( rPreviewSizeHint );
+                               mbStatus = false; // only one IHDR possible
                        }
                        break;
 


Reply via email to