diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-07-05 16:13:03 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-07-05 20:12:02 +0100 |
commit | d6db7e20d31280547ab15455ad1bc2a6d84ca76e (patch) | |
tree | 287d6ce5be52fcd2b0827df77e7c16d9f32ad1ec | |
parent | 9fac093b76811be99d390d5cec30c3f7cb2361ae (diff) |
ppc64: fix infinite loop with default unsigned char
Change-Id: I4c1d4c9228113bf83e8aabb50f153d2658c3cf59
-rw-r--r-- | filter/source/graphicfilter/ipsd/ipsd.cxx | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/filter/source/graphicfilter/ipsd/ipsd.cxx b/filter/source/graphicfilter/ipsd/ipsd.cxx index be25647dc0ec..0e256ae5b21d 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 { |