check stream status more often
Change-Id: I233c2fff9c06a81117f8114ccee83b53ea4026db
This commit is contained in:
BIN
filter/qa/cppunit/data/ras/fail/hang-1.ras
Normal file
BIN
filter/qa/cppunit/data/ras/fail/hang-1.ras
Normal file
Binary file not shown.
@@ -222,32 +222,44 @@ 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 (!( ( 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 ( 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 24 :
|
||||
@@ -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 ( 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,10 +315,10 @@ bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
|
||||
nRed = ImplGetByte();
|
||||
}
|
||||
pAcc->SetPixel ( y, x, BitmapColor( nRed, nGreen, nBlue ) );
|
||||
}
|
||||
if (!m_rRAS.good())
|
||||
mbStatus = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
Reference in New Issue
Block a user