[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - filter/qa filter/source

Caolán McNamara caolanm at redhat.com
Tue Sep 1 01:59:02 PDT 2015


 filter/qa/cppunit/data/pict/fail/hang-1.pct |binary
 filter/source/graphicfilter/ipict/ipict.cxx |   10 ++++++----
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 508125f9e77c0ef2c5a49a1a4cd08d60ad63492c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Aug 31 09:55:37 2015 +0100

    check stream status
    
    Change-Id: I65ed5979d35d8739367294a71620782b832cfd71
    (cherry picked from commit a8fe085f973b4ccf846fe231af0fa25eda59911e)
    Reviewed-on: https://gerrit.libreoffice.org/18160
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

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 0000000..735ce0a
Binary files /dev/null and b/filter/qa/cppunit/data/pict/fail/hang-1.pct differ
diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx
index 53f4c3a..0ceb4dd 100644
--- a/filter/source/graphicfilter/ipict/ipict.cxx
+++ b/filter/source/graphicfilter/ipict/ipict.cxx
@@ -824,8 +824,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;
@@ -851,6 +850,7 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
             }
             else
             {
+                sal_uInt16 nByteCount(0);
                 if ( nRowBytes > 250 )
                 {
                     pPict->ReadUInt16( nByteCount );
@@ -858,14 +858,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;


More information about the Libreoffice-commits mailing list