summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-07-05 16:13:03 +0100
committerAndras Timar <andras.timar@collabora.com>2015-07-08 12:04:16 +0200
commit196de69bf650f2d96ecb60d5c118ed47c1587da1 (patch)
tree1cb6118fad1ebc863469d645f59ee34382e45df9
parentef3c82bcc1f090aca519f91fe1923466ec08778d (diff)
ppc64: fix infinite loop with default unsigned char
(cherry picked from commit d6db7e20d31280547ab15455ad1bc2a6d84ca76e) Change-Id: I4c1d4c9228113bf83e8aabb50f153d2658c3cf59 Reviewed-on: https://gerrit.libreoffice.org/16776 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--filter/source/graphicfilter/ipsd/ipsd.cxx47
1 files changed, 39 insertions, 8 deletions
diff --git a/filter/source/graphicfilter/ipsd/ipsd.cxx b/filter/source/graphicfilter/ipsd/ipsd.cxx
index 95b9e937a429..bae2c0b19fc8 100644
--- a/filter/source/graphicfilter/ipsd/ipsd.cxx
+++ b/filter/source/graphicfilter/ipsd/ipsd.cxx
@@ -338,7 +338,7 @@ bool PSDReader::ImplReadHeader()
bool PSDReader::ImplReadBody()
{
sal_uLong nX, nY;
- char nRunCount = 0;
+ signed char nRunCount = 0;
signed char nBitCount = -1;
sal_uInt8 nDat = 0, nDummy, nRed, nGreen, nBlue;
BitmapColor aBitmapColor;
@@ -353,7 +353,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
{
@@ -406,7 +410,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
{
@@ -455,7 +463,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
{
@@ -496,7 +509,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 );
@@ -538,7 +556,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 );
@@ -584,7 +607,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
{
@@ -669,7 +696,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
{