ofz#4305 do not read past end of file
Change-Id: I7e048c012296fc080434e527c533ea987184699b
This commit is contained in:
parent
e21f7f7ef0
commit
b3ff2c7be0
2 changed files with 11 additions and 2 deletions
|
@ -82,6 +82,9 @@ generate_Opcodes(LotusContext &rContext, SvStream& aStream,
|
|||
sal_uInt16 nOpcode(LOTUS_EOF), nLength(0);
|
||||
|
||||
aStream.ReadUInt16(nOpcode).ReadUInt16(nLength);
|
||||
if (!aStream.good())
|
||||
break;
|
||||
|
||||
aPrgrsBar.Progress();
|
||||
if( nOpcode == LOTUS_EOF )
|
||||
rContext.bEOF = true;
|
||||
|
@ -118,7 +121,9 @@ generate_Opcodes(LotusContext &rContext, SvStream& aStream,
|
|||
|
||||
MemDelete(rContext);
|
||||
|
||||
if (nErr == ERRCODE_NONE)
|
||||
if (!aStream.good())
|
||||
nErr = SCERR_IMPORT_FORMAT;
|
||||
else if (nErr == ERRCODE_NONE)
|
||||
rContext.pDoc->CalcAfterLoad();
|
||||
|
||||
return nErr;
|
||||
|
|
|
@ -151,6 +151,8 @@ void OP_Formula(LotusContext &rContext, SvStream& r, sal_uInt16 /*n*/)
|
|||
LotusToSc aConv(rContext, r, rSPool, rContext.pLotusRoot->eCharsetQ, false);
|
||||
aConv.Reset( aAddress );
|
||||
aConv.Convert( pErg, nBytesLeft );
|
||||
if (!r.good())
|
||||
return;
|
||||
|
||||
if (ValidColRow(nCol, nRow))
|
||||
{
|
||||
|
@ -399,6 +401,8 @@ void OP_Formula123(LotusContext& rContext, SvStream& r, sal_uInt16 n)
|
|||
LotusToSc aConv(rContext, r, rSPool, rContext.pLotusRoot->eCharsetQ, true);
|
||||
aConv.Reset( aAddress );
|
||||
aConv.Convert( pErg, nBytesLeft );
|
||||
if (!r.good())
|
||||
return;
|
||||
|
||||
if (ValidColRow(nCol, nRow) && nTab <= rContext.pDoc->GetMaxTableNumber())
|
||||
{
|
||||
|
@ -658,7 +662,7 @@ void OP_ApplyPatternArea123(LotusContext& rContext, SvStream& rStream)
|
|||
break;
|
||||
}
|
||||
}
|
||||
while( nLevel && !rStream.IsEof() );
|
||||
while( nLevel && !rStream.IsEof() && rStream.good() );
|
||||
|
||||
rContext.aLotusPatternPool.clear();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue