[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - filter/qa filter/source
Caolán McNamara
caolanm at redhat.com
Mon Sep 14 00:28:55 PDT 2015
filter/qa/cppunit/data/ras/fail/hang-1.ras |binary
filter/source/graphicfilter/iras/iras.cxx | 47 +++++++++++++++++++----------
2 files changed, 32 insertions(+), 15 deletions(-)
New commits:
commit 76b1c431637e993bc38af2e56197634864909f48
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Sep 11 15:38:01 2015 +0100
check stream status more often
Change-Id: I233c2fff9c06a81117f8114ccee83b53ea4026db
(cherry picked from commit b43e03353aeb04ed74a272d98df03dd7c20f3478)
Reviewed-on: https://gerrit.libreoffice.org/18506
Reviewed-by: David Tardon <dtardon at redhat.com>
Tested-by: David Tardon <dtardon at redhat.com>
diff --git a/filter/qa/cppunit/data/ras/fail/hang-1.ras b/filter/qa/cppunit/data/ras/fail/hang-1.ras
new file mode 100644
index 0000000..44dec67
Binary files /dev/null and b/filter/qa/cppunit/data/ras/fail/hang-1.ras differ
diff --git a/filter/source/graphicfilter/iras/iras.cxx b/filter/source/graphicfilter/iras/iras.cxx
index 61d5128..d7351c9 100644
--- a/filter/source/graphicfilter/iras/iras.cxx
+++ b/filter/source/graphicfilter/iras/iras.cxx
@@ -222,31 +222,43 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
case 1 :
for (y = 0; y < mnHeight && mbStatus; ++y)
{
- for ( x = 0; x < mnWidth; x++ )
+ for (x = 0; x < mnWidth && mbStatus; ++x)
{
if (!(x & 7))
+ {
nDat = ImplGetByte();
+ if (!m_rRAS.good())
+ mbStatus = false;
+ }
pAcc->SetPixelIndex( y, x,
sal::static_int_cast< sal_uInt8 >(
nDat >> ( ( x & 7 ) ^ 7 )) );
}
- if (!( ( x - 1 ) & 0x8 ) ) ImplGetByte(); // WORD ALIGNMENT ???
- if (!m_rRAS.good())
- mbStatus = false;
+ if (!( ( x - 1 ) & 0x8 ) )
+ {
+ ImplGetByte(); // WORD ALIGNMENT ???
+ if (!m_rRAS.good())
+ mbStatus = false;
+ }
}
break;
case 8 :
for (y = 0; y < mnHeight && mbStatus; ++y)
{
- for ( x = 0; x < mnWidth; x++ )
+ for (x = 0; x < mnWidth && mbStatus; ++x)
{
nDat = ImplGetByte();
pAcc->SetPixelIndex( y, x, nDat );
+ if (!m_rRAS.good())
+ mbStatus = false;
+ }
+ if ( x & 1 )
+ {
+ ImplGetByte(); // WORD ALIGNMENT ???
+ if (!m_rRAS.good())
+ mbStatus = false;
}
- if ( x & 1 ) ImplGetByte(); // WORD ALIGNMENT ???
- if (!m_rRAS.good())
- mbStatus = false;
}
break;
@@ -257,7 +269,7 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
case 24 :
for (y = 0; y < mnHeight && mbStatus; ++y)
{
- for ( x = 0; x < mnWidth; x++ )
+ for (x = 0; x < mnWidth && mbStatus; ++x)
{
if ( mnType == RAS_TYPE_RGB_FORMAT )
{
@@ -272,17 +284,22 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
nRed = ImplGetByte();
}
pAcc->SetPixel ( y, x, BitmapColor( nRed, nGreen, nBlue ) );
+ if (!m_rRAS.good())
+ mbStatus = false;
+ }
+ if ( x & 1 )
+ {
+ ImplGetByte(); // WORD ALIGNMENT ???
+ if (!m_rRAS.good())
+ mbStatus = false;
}
- if ( x & 1 ) ImplGetByte(); // WORD ALIGNMENT ???
- if (!m_rRAS.good())
- mbStatus = false;
}
break;
case 32 :
for (y = 0; y < mnHeight && mbStatus; ++y)
{
- for ( x = 0; x < mnWidth; x++ )
+ for (x = 0; x < mnWidth && mbStatus; ++x)
{
nDat = ImplGetByte(); // pad byte > nil
if ( mnType == RAS_TYPE_RGB_FORMAT )
@@ -298,9 +315,9 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
nRed = ImplGetByte();
}
pAcc->SetPixel ( y, x, BitmapColor( nRed, nGreen, nBlue ) );
+ if (!m_rRAS.good())
+ mbStatus = false;
}
- if (!m_rRAS.good())
- mbStatus = false;
}
break;
}
More information about the Libreoffice-commits
mailing list