summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-01-31 09:28:24 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-01-31 09:28:24 +0000
commitd635fc5f50e35aabb68d8db9775d5d4da747c1a1 (patch)
tree483eac3134504780e7755fb64b0d01d0ded85daa /vcl
parent6cf883c29090d7caf9e1a5546309f1bf087b0bd8 (diff)
ofz: Infinite loop
Change-Id: I3f3ebaea1fe3a3b3919fe204bd8769287e84deaf
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/pngread.cxx9
1 files changed, 5 insertions, 4 deletions
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();