From d635fc5f50e35aabb68d8db9775d5d4da747c1a1 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 31 Jan 2018 09:28:24 +0000 Subject: ofz: Infinite loop Change-Id: I3f3ebaea1fe3a3b3919fe204bd8769287e84deaf --- vcl/source/gdi/pngread.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'vcl') 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(); -- cgit