summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-08-31 09:55:37 +0100
committerAndras Timar <andras.timar@collabora.com>2015-09-04 17:11:16 +0200
commit0d5a671b4c848f077b03c21a3159f3a30495b432 (patch)
tree1c188cb1a2d9ecbc0a20b0ae6b23967a3c34f292
parente8405fbe2a0efb8dea2b0777097153563bee4bd8 (diff)
check stream status
Change-Id: I65ed5979d35d8739367294a71620782b832cfd71 (cherry picked from commit a8fe085f973b4ccf846fe231af0fa25eda59911e) Reviewed-on: https://gerrit.libreoffice.org/18161 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--filter/qa/cppunit/data/pict/fail/hang-1.pctbin0 -> 97206 bytes
-rw-r--r--filter/source/graphicfilter/ipict/ipict.cxx10
2 files changed, 6 insertions, 4 deletions
diff --git a/filter/qa/cppunit/data/pict/fail/hang-1.pct b/filter/qa/cppunit/data/pict/fail/hang-1.pct
new file mode 100644
index 000000000000..735ce0aca7f3
--- /dev/null
+++ b/filter/qa/cppunit/data/pict/fail/hang-1.pct
Binary files differ
diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx
index 4f0e431a5742..6fd4fbb8796d 100644
--- a/filter/source/graphicfilter/ipict/ipict.cxx
+++ b/filter/source/graphicfilter/ipict/ipict.cxx
@@ -832,8 +832,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
// read and write Bitmap bits:
if ( nPixelSize == 1 || nPixelSize == 2 || nPixelSize == 4 || nPixelSize == 8 )
{
- sal_uInt8 nByteCountAsByte, nFlagCounterByte;
- sal_uInt16 nByteCount, nSrcBPL, nDestBPL;
+ sal_uInt16 nSrcBPL, nDestBPL;
size_t nCount;
if ( nPixelSize == 1 ) nSrcBPL = ( nWidth + 7 ) >> 3;
@@ -859,6 +858,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
}
else
{
+ sal_uInt16 nByteCount(0);
if ( nRowBytes > 250 )
{
pPict->ReadUInt16( nByteCount );
@@ -866,14 +866,16 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
}
else
{
+ sal_uInt8 nByteCountAsByte(0);
pPict->ReadUChar( nByteCountAsByte );
nByteCount = ( (sal_uInt16)nByteCountAsByte ) & 0x00ff;
nDataSize += 1 + (sal_uLong)nByteCount;
}
- while ( nByteCount )
+ while (pPict->good() && nByteCount)
{
- pPict->ReadUChar( nFlagCounterByte );
+ sal_uInt8 nFlagCounterByte(0);
+ pPict->ReadUChar(nFlagCounterByte);
if ( ( nFlagCounterByte & 0x80 ) == 0 )
{
nCount = ( (sal_uInt16)nFlagCounterByte ) + 1;