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

Caolán McNamara caolanm at redhat.com
Wed Jan 31 09:33:58 UTC 2018


 vcl/source/gdi/pngread.cxx |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit d635fc5f50e35aabb68d8db9775d5d4da747c1a1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jan 31 09:28:24 2018 +0000

    ofz: Infinite loop
    
    Change-Id: I3f3ebaea1fe3a3b3919fe204bd8769287e84deaf

diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index 35ec3b3bb595..e954a50780ce 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -294,10 +294,11 @@ bool PNGReaderImpl::ReadNextChunk()
             rChunkData.aData.resize( mnChunkLen );
 
             sal_Int32 nBytesRead = 0;
-            do {
-                sal_uInt8* pPtr = &rChunkData.aData[ nBytesRead ];
-                nBytesRead += mrPNGStream.ReadBytes(pPtr, mnChunkLen - nBytesRead);
-            } while ( ( nBytesRead < mnChunkLen ) && ( mrPNGStream.GetError() == ERRCODE_NONE ) );
+            do
+            {
+                sal_uInt8& rPtr = rChunkData.aData[nBytesRead];
+                nBytesRead += mrPNGStream.ReadBytes(&rPtr, mnChunkLen - nBytesRead);
+            } while (nBytesRead < mnChunkLen && mrPNGStream.good());
 
             nCRC32 = rtl_crc32( nCRC32, &rChunkData.aData[ 0 ], mnChunkLen );
             maDataIter = rChunkData.aData.begin();


More information about the Libreoffice-commits mailing list