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

Caolán McNamara caolanm at redhat.com
Sun Jul 5 12:12:29 PDT 2015


 filter/source/graphicfilter/ipsd/ipsd.cxx |   47 ++++++++++++++++++++++++------
 1 file changed, 39 insertions(+), 8 deletions(-)

New commits:
commit d6db7e20d31280547ab15455ad1bc2a6d84ca76e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jul 5 16:13:03 2015 +0100

    ppc64: fix infinite loop with default unsigned char
    
    Change-Id: I4c1d4c9228113bf83e8aabb50f153d2658c3cf59

diff --git a/filter/source/graphicfilter/ipsd/ipsd.cxx b/filter/source/graphicfilter/ipsd/ipsd.cxx
index be25647..0e256ae 100644
--- a/filter/source/graphicfilter/ipsd/ipsd.cxx
+++ b/filter/source/graphicfilter/ipsd/ipsd.cxx
@@ -331,7 +331,7 @@ bool PSDReader::ImplReadHeader()
 bool PSDReader::ImplReadBody()
 {
     sal_uLong       nX, nY;
-    char        nRunCount = 0;
+    signed char nRunCount = 0;
     sal_uInt8       nDat = 0, nDummy, nRed, nGreen, nBlue;
     BitmapColor aBitmapColor;
     nX = nY = 0;
@@ -346,7 +346,11 @@ bool PSDReader::ImplReadBody()
                 if ( nBitCount == -1 )
                 {
                     if ( mbCompression )    // else nRunCount = 0 -> so we use only single raw packets
-                        m_rPSD.ReadChar( nRunCount );
+                    {
+                        char nTmp(0);
+                        m_rPSD.ReadChar(nTmp);
+                        nRunCount = nTmp;
+                    }
                 }
                 if ( nRunCount & 0x80 )     // a run length packet
                 {
@@ -399,7 +403,11 @@ bool PSDReader::ImplReadBody()
             while ( nY < mpFileHeader->nRows )
             {
                 if ( mbCompression )        // else nRunCount = 0 -> so we use only single raw packets
-                    m_rPSD.ReadChar( nRunCount );
+                {
+                    char nTmp(0);
+                    m_rPSD.ReadChar(nTmp);
+                    nRunCount = nTmp;
+                }
 
                 if ( nRunCount & 0x80 )     // a run length packet
                 {
@@ -448,7 +456,12 @@ bool PSDReader::ImplReadBody()
             while ( nY < mpFileHeader->nRows )
             {
                 if ( mbCompression )        // else nRunCount = 0 -> so we use only single raw packets
-                    m_rPSD.ReadChar( nRunCount );
+                {
+                    char nTmp(0);
+                    m_rPSD.ReadChar(nTmp);
+                    nRunCount = nTmp;
+                }
+
 
                 if ( nRunCount & 0x80 )     // a run length packet
                 {
@@ -489,7 +502,12 @@ bool PSDReader::ImplReadBody()
             while ( nY < mpFileHeader->nRows )
             {
                 if ( mbCompression )
-                    m_rPSD.ReadChar( nRunCount );
+                {
+                    char nTmp(0);
+                    m_rPSD.ReadChar(nTmp);
+                    nRunCount = nTmp;
+                }
+
                 if ( nRunCount & 0x80 )     // a run length packet
                 {
                     m_rPSD.ReadUChar( nGreen );
@@ -531,7 +549,12 @@ bool PSDReader::ImplReadBody()
             while ( nY < mpFileHeader->nRows )
             {
                 if ( mbCompression )
-                    m_rPSD.ReadChar( nRunCount );
+                {
+                    char nTmp(0);
+                    m_rPSD.ReadChar(nTmp);
+                    nRunCount = nTmp;
+                }
+
                 if ( nRunCount & 0x80 )     // a run length packet
                 {
                     m_rPSD.ReadUChar( nBlue );
@@ -577,7 +600,11 @@ bool PSDReader::ImplReadBody()
                 while ( nY < mpFileHeader->nRows )
                 {
                     if ( mbCompression )        // else nRunCount = 0 -> so we use only single raw packets
-                        m_rPSD.ReadChar( nRunCount );
+                    {
+                        char nTmp(0);
+                        m_rPSD.ReadChar(nTmp);
+                        nRunCount = nTmp;
+                    }
 
                     if ( nRunCount & 0x80 )     // a run length packet
                     {
@@ -662,7 +689,11 @@ bool PSDReader::ImplReadBody()
         while ( nY < mpFileHeader->nRows )
         {
             if ( mbCompression )        // else nRunCount = 0 -> so we use only single raw packets
-                m_rPSD.ReadChar( nRunCount );
+            {
+                char nTmp(0);
+                m_rPSD.ReadChar(nTmp);
+                nRunCount = nTmp;
+            }
 
             if ( nRunCount & 0x80 )     // a run length packet
             {


More information about the Libreoffice-commits mailing list