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

Caolán McNamara caolanm at redhat.com
Tue Jul 7 13:43:06 PDT 2015


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

New commits:
commit 64c1b98eea0ff3c9781c78d2b95541a4b8bd4070
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
    (cherry picked from commit d6db7e20d31280547ab15455ad1bc2a6d84ca76e)
    Reviewed-on: https://gerrit.libreoffice.org/16775
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/filter/source/graphicfilter/ipsd/ipsd.cxx b/filter/source/graphicfilter/ipsd/ipsd.cxx
index c25468c..7fbd5ab 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