Kaydet (Commit) 1847753a authored tarafından Caolán McNamara's avatar Caolán McNamara

check seeks and reads

Change-Id: I0c5c4784713376e0762bfbd197640f8d31b65562
üst 894151e8
...@@ -786,7 +786,8 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi ...@@ -786,7 +786,8 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
} }
break; break;
} }
aClientDataHd.SeekToEndOfRecord( rSt ); if (!aClientDataHd.SeekToEndOfRecord(rSt))
break;
} }
} }
if ( ( aPlaceholderAtom.nPlaceholderId == PptPlaceholder::NOTESSLIDEIMAGE ) && !rPersistEntry.bNotesMaster ) if ( ( aPlaceholderAtom.nPlaceholderId == PptPlaceholder::NOTESSLIDEIMAGE ) && !rPersistEntry.bNotesMaster )
...@@ -1810,7 +1811,10 @@ SdrObject* SdrPowerPointImport::ImportOLE( long nOLEId, ...@@ -1810,7 +1811,10 @@ SdrObject* SdrPowerPointImport::ImportOLE( long nOLEId,
break; break;
} }
else else
aPlaceHd.SeekToEndOfRecord( rStCtrl ); {
if (!aPlaceHd.SeekToEndOfRecord(rStCtrl))
break;
}
} }
} }
...@@ -2402,7 +2406,8 @@ bool SdrPowerPointImport::SeekToContentOfProgTag( sal_Int32 nVersion, SvStream& ...@@ -2402,7 +2406,8 @@ bool SdrPowerPointImport::SeekToContentOfProgTag( sal_Int32 nVersion, SvStream&
} }
} }
} }
aProgTagBinaryDataHd.SeekToEndOfRecord( rSt ); if (!aProgTagBinaryDataHd.SeekToEndOfRecord(rSt))
break;
} }
} }
if ( !bRetValue ) if ( !bRetValue )
...@@ -2703,7 +2708,8 @@ void ImportComment10( SvxMSDffManager& rMan, SvStream& rStCtrl, SdrPage* pPage, ...@@ -2703,7 +2708,8 @@ void ImportComment10( SvxMSDffManager& rMan, SvStream& rStCtrl, SdrPage* pPage,
} }
break; break;
} }
aCommentHd.SeekToEndOfRecord( rStCtrl ); if (!aCommentHd.SeekToEndOfRecord(rStCtrl))
break;
} }
Point aPosition( nPosX, nPosY ); Point aPosition( nPosX, nPosY );
rMan.Scale( aPosition ); rMan.Scale( aPosition );
...@@ -2763,7 +2769,8 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry* ...@@ -2763,7 +2769,8 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry*
while( ( rStCtrl.GetError() == 0 ) && SeekToRec( rStCtrl, PPT_PST_Comment10, aContentDataHd.GetRecEndFilePos(), &aComment10Hd ) ) while( ( rStCtrl.GetError() == 0 ) && SeekToRec( rStCtrl, PPT_PST_Comment10, aContentDataHd.GetRecEndFilePos(), &aComment10Hd ) )
{ {
ImportComment10( *this, rStCtrl, pRet, aComment10Hd ); ImportComment10( *this, rStCtrl, pRet, aComment10Hd );
aComment10Hd.SeekToEndOfRecord( rStCtrl ); if (!aComment10Hd.SeekToEndOfRecord(rStCtrl))
break;
} }
} }
} }
...@@ -2841,7 +2848,8 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry* ...@@ -2841,7 +2848,8 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry*
} }
if ( aEscherObjListHd.nRecType == DFF_msofbtSpContainer ) if ( aEscherObjListHd.nRecType == DFF_msofbtSpContainer )
break; break;
aEscherObjListHd.SeekToEndOfRecord( rStCtrl ); if (!aEscherObjListHd.SeekToEndOfRecord(rStCtrl))
break;
} }
// now importing page // now importing page
...@@ -2891,7 +2899,8 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry* ...@@ -2891,7 +2899,8 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry*
} }
if ( aEscherObjListHd.nRecType == DFF_msofbtSpgrContainer ) if ( aEscherObjListHd.nRecType == DFF_msofbtSpgrContainer )
break; break;
aEscherObjListHd.SeekToEndOfRecord( rStCtrl ); if (!aEscherObjListHd.SeekToEndOfRecord(rStCtrl))
break;
} }
if ( rSlidePersist.pBObj ) if ( rSlidePersist.pBObj )
...@@ -2907,7 +2916,8 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry* ...@@ -2907,7 +2916,8 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry*
} }
break; break;
} }
aHd.SeekToEndOfRecord( rStCtrl ); if (!aHd.SeekToEndOfRecord(rStCtrl))
break;
} }
if ( rSlidePersist.pSolverContainer ) if ( rSlidePersist.pSolverContainer )
SolveSolver( *rSlidePersist.pSolverContainer ); SolveSolver( *rSlidePersist.pSolverContainer );
...@@ -3116,7 +3126,8 @@ void SdrEscherImport::ImportHeaderFooterContainer( DffRecordHeader& rHd, HeaderF ...@@ -3116,7 +3126,8 @@ void SdrEscherImport::ImportHeaderFooterContainer( DffRecordHeader& rHd, HeaderF
} }
break; break;
} }
aHd.SeekToEndOfRecord( rStCtrl ); if (!aHd.SeekToEndOfRecord(rStCtrl))
break;
} }
} }
...@@ -3246,7 +3257,8 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const ...@@ -3246,7 +3257,8 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const
#ifdef DBG_UTIL #ifdef DBG_UTIL
else OSL_FAIL( "PPTExParaProv::PPTExParaProv - unknown atom interpreting the PPT_PST_ExtendedBuGraContainer (SJ)" ); else OSL_FAIL( "PPTExParaProv::PPTExParaProv - unknown atom interpreting the PPT_PST_ExtendedBuGraContainer (SJ)" );
#endif #endif
aBuGraAtomHd.SeekToEndOfRecord( rSt ); if (!aBuGraAtomHd.SeekToEndOfRecord(rSt))
break;
} }
if ( !aBuGraList.empty() ) if ( !aBuGraList.empty() )
bGraphics = true; bGraphics = true;
...@@ -3270,7 +3282,8 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const ...@@ -3270,7 +3282,8 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const
break; break;
#endif #endif
} }
aHd.SeekToEndOfRecord( rSt ); if (!aHd.SeekToEndOfRecord(rSt))
break;
} }
} }
...@@ -3319,7 +3332,8 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const ...@@ -3319,7 +3332,8 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const
case 0xf144 : case 0xf144 :
break; break;
} }
aHd.SeekToEndOfRecord( rSt ); if (!aHd.SeekToEndOfRecord(rSt))
break;
} }
} }
rSt.Seek( nOldPos ); rSt.Seek( nOldPos );
...@@ -4096,7 +4110,10 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd ...@@ -4096,7 +4110,10 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd
break; break;
} }
else else
aTxMasterStyleHd.SeekToEndOfRecord( rIn ); {
if (!aTxMasterStyleHd.SeekToEndOfRecord(rIn))
break;
}
} }
} }
...@@ -4110,7 +4127,10 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd ...@@ -4110,7 +4127,10 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd
if ( aTxMasterStyleHd.nRecType == PPT_PST_TxMasterStyleAtom ) if ( aTxMasterStyleHd.nRecType == PPT_PST_TxMasterStyleAtom )
break; break;
else else
aTxMasterStyleHd.SeekToEndOfRecord( rIn ); {
if (!aTxMasterStyleHd.SeekToEndOfRecord(rIn))
break;
}
} }
while ( ( aTxMasterStyleHd.nRecType == PPT_PST_TxMasterStyleAtom ) && ( rIn.Tell() < nEndRecPos ) ) //TODO: aTxMasterStyleHd may be used without having been properly initialized while ( ( aTxMasterStyleHd.nRecType == PPT_PST_TxMasterStyleAtom ) && ( rIn.Tell() < nEndRecPos ) ) //TODO: aTxMasterStyleHd may be used without having been properly initialized
{ {
...@@ -4212,7 +4232,8 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd ...@@ -4212,7 +4232,8 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd
} }
#endif #endif
} }
aTxMasterStyleHd.SeekToEndOfRecord( rIn ); if (!aTxMasterStyleHd.SeekToEndOfRecord(rIn))
break;
ReadDffRecordHeader( rIn, aTxMasterStyleHd ); ReadDffRecordHeader( rIn, aTxMasterStyleHd );
} }
if ( !mpCharSheet[ TSS_TYPE_SUBTITLE ] ) if ( !mpCharSheet[ TSS_TYPE_SUBTITLE ] )
...@@ -4285,7 +4306,10 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd ...@@ -4285,7 +4306,10 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd
break; break;
} }
else else
aTxMasterStyleHd2.SeekToEndOfRecord( rIn ); {
if (!aTxMasterStyleHd2.SeekToEndOfRecord(rIn))
break;
}
} }
} }
} }
...@@ -6480,7 +6504,8 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport ...@@ -6480,7 +6504,8 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
if ( ( nTmpSlideId == nSlideId ) && ( pHd->nRecInstance == nRefNum ) ) if ( ( nTmpSlideId == nSlideId ) && ( pHd->nRecInstance == nRefNum ) )
{ {
pHd->SeekToEndOfRecord( rIn ); if (!pHd->SeekToEndOfRecord(rIn))
break;
ReadDffRecordHeader( rIn, aPresRuleHd ); ReadDffRecordHeader( rIn, aPresRuleHd );
if ( aPresRuleHd.nRecType == PPT_PST_ExtendedParagraphAtom ) if ( aPresRuleHd.nRecType == PPT_PST_ExtendedParagraphAtom )
{ {
...@@ -6810,7 +6835,8 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport ...@@ -6810,7 +6835,8 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
} }
break; break;
} }
aTextHd.SeekToEndOfRecord( rIn ); if (!aTextHd.SeekToEndOfRecord(rIn))
break;
if ( pEntry ) if ( pEntry )
{ {
// sorting fields ( hi >> lo ) // sorting fields ( hi >> lo )
......
...@@ -521,7 +521,8 @@ bool ImplSdPPTImport::Import() ...@@ -521,7 +521,8 @@ bool ImplSdPPTImport::Import()
break; break;
rStCtrl.SeekRel( 8 ); rStCtrl.SeekRel( 8 );
rStCtrl.ReadUInt32( pPtr->nIndex ); rStCtrl.ReadUInt32( pPtr->nIndex );
aHyperE.SeekToEndOfRecord( rStCtrl ); if (!aHyperE.SeekToEndOfRecord(rStCtrl))
break;
} }
} }
} }
...@@ -826,7 +827,8 @@ bool ImplSdPPTImport::Import() ...@@ -826,7 +827,8 @@ bool ImplSdPPTImport::Import()
} }
break; break;
} }
aProgTagContentHd.SeekToEndOfRecord( rStCtrl ); if (!aProgTagContentHd.SeekToEndOfRecord(rStCtrl))
break;
} }
} }
} }
...@@ -953,7 +955,8 @@ bool ImplSdPPTImport::Import() ...@@ -953,7 +955,8 @@ bool ImplSdPPTImport::Import()
case PPT_PST_SlideTime10Atom : // ??? don't know, this atom is always 8 bytes big case PPT_PST_SlideTime10Atom : // ??? don't know, this atom is always 8 bytes big
break; // and is appearing in nearly every l10 progtag break; // and is appearing in nearly every l10 progtag
} }
aProgTagContentHd.SeekToEndOfRecord( rStCtrl ); if (!aProgTagContentHd.SeekToEndOfRecord(rStCtrl))
break;
} }
} }
} }
...@@ -965,7 +968,8 @@ bool ImplSdPPTImport::Import() ...@@ -965,7 +968,8 @@ bool ImplSdPPTImport::Import()
break; break;
} }
aHd.SeekToEndOfRecord( rStCtrl ); if (!aHd.SeekToEndOfRecord(rStCtrl))
break;
} }
ImportPageEffect( pPage, bNewAnimationsUsed ); ImportPageEffect( pPage, bNewAnimationsUsed );
} }
...@@ -1786,7 +1790,8 @@ void ImplSdPPTImport::ImportPageEffect( SdPage* pPage, const bool bNewAnimations ...@@ -1786,7 +1790,8 @@ void ImplSdPPTImport::ImportPageEffect( SdPage* pPage, const bool bNewAnimations
} }
} }
} }
aHd.SeekToEndOfRecord( rStCtrl ); if (!aHd.SeekToEndOfRecord(rStCtrl))
break;
} }
if ( bTryTwice && !bSSSlideInfoAtom ) if ( bTryTwice && !bSSSlideInfoAtom )
{ {
...@@ -1948,7 +1953,10 @@ OUString ImplSdPPTImport::ReadSound(sal_uInt32 nSoundRef) const ...@@ -1948,7 +1953,10 @@ OUString ImplSdPPTImport::ReadSound(sal_uInt32 nSoundRef) const
} }
} }
if ( !bDone ) if ( !bDone )
aSoundRecHd.SeekToEndOfRecord( rStCtrl ); {
if (!aSoundRecHd.SeekToEndOfRecord(rStCtrl))
break;
}
} }
} }
} }
...@@ -2009,7 +2017,8 @@ OUString ImplSdPPTImport::ReadMedia( sal_uInt32 nMediaRef ) const ...@@ -2009,7 +2017,8 @@ OUString ImplSdPPTImport::ReadMedia( sal_uInt32 nMediaRef ) const
} }
break; break;
} }
aHd.SeekToEndOfRecord( rStCtrl ); if (!aHd.SeekToEndOfRecord(rStCtrl))
break;
} }
break; break;
} }
...@@ -2018,7 +2027,8 @@ OUString ImplSdPPTImport::ReadMedia( sal_uInt32 nMediaRef ) const ...@@ -2018,7 +2027,8 @@ OUString ImplSdPPTImport::ReadMedia( sal_uInt32 nMediaRef ) const
} }
break; break;
} }
aHdMovie.SeekToEndOfRecord( rStCtrl ); if (!aHdMovie.SeekToEndOfRecord(rStCtrl))
break;
} }
} }
return aRetVal; return aRetVal;
...@@ -2676,7 +2686,8 @@ SdrObject* ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi ...@@ -2676,7 +2686,8 @@ SdrObject* ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
} }
break; break;
} }
aHd.SeekToEndOfRecord( rSt ); if (!aHd.SeekToEndOfRecord(rSt))
break;
} }
while( ( rSt.GetError() == 0 ) && ( rSt.Tell() < nClientDataLen ) ); while( ( rSt.GetError() == 0 ) && ( rSt.Tell() < nClientDataLen ) );
......
...@@ -319,7 +319,7 @@ bool Section::GetDictionary( Dictionary& rDict ) ...@@ -319,7 +319,7 @@ bool Section::GetDictionary( Dictionary& rDict )
void Section::Read( SotStorageStream *pStrm ) void Section::Read( SotStorageStream *pStrm )
{ {
sal_uInt32 i, nSecOfs, nPropSize, nStrmSize; sal_uInt32 nSecOfs, nPropSize, nStrmSize;
nSecOfs = pStrm->Tell(); nSecOfs = pStrm->Tell();
pStrm->Seek( STREAM_SEEK_TO_END ); pStrm->Seek( STREAM_SEEK_TO_END );
...@@ -357,7 +357,7 @@ void Section::Read( SotStorageStream *pStrm ) ...@@ -357,7 +357,7 @@ void Section::Read( SotStorageStream *pStrm )
bool bVariant = ( nPropType == VT_VARIANT ); bool bVariant = ( nPropType == VT_VARIANT );
for ( i = 0; nPropSize && ( i < nVectorCount ); i++ ) for (sal_uInt32 i = 0; nPropSize && ( i < nVectorCount ); ++i)
{ {
if ( bVariant ) if ( bVariant )
{ {
...@@ -453,7 +453,7 @@ void Section::Read( SotStorageStream *pStrm ) ...@@ -453,7 +453,7 @@ void Section::Read( SotStorageStream *pStrm )
if( nPropSize > nSecSize - nSecOfs ) if( nPropSize > nSecSize - nSecOfs )
nPropSize = nSecSize - nSecOfs; nPropSize = nSecSize - nSecOfs;
sal_uInt8* pBuf = new sal_uInt8[ nPropSize ]; sal_uInt8* pBuf = new sal_uInt8[ nPropSize ];
pStrm->Read( pBuf, nPropSize ); nPropSize = pStrm->Read(pBuf, nPropSize);
AddProperty( nPropId, pBuf, nPropSize ); AddProperty( nPropId, pBuf, nPropSize );
delete[] pBuf; delete[] pBuf;
} }
...@@ -488,14 +488,17 @@ void Section::Read( SotStorageStream *pStrm ) ...@@ -488,14 +488,17 @@ void Section::Read( SotStorageStream *pStrm )
} }
else else
{ {
sal_uInt32 nDictCount, nSize; sal_uInt32 nDictCount(0);
pStrm->ReadUInt32( nDictCount ); pStrm->ReadUInt32(nDictCount);
for ( i = 0; i < nDictCount; i++ ) for (sal_uInt32 i = 0; i < nDictCount; ++i)
{ {
sal_uInt32 nSize(0);
pStrm->ReadUInt32( nSize ).ReadUInt32( nSize ); pStrm->ReadUInt32( nSize ).ReadUInt32( nSize );
pStrm->SeekRel( nSize ); sal_uInt64 nPos = pStrm->Tell() + nSize;
if (nPos != pStrm->Seek(nPos))
break;
} }
nSize = pStrm->Tell(); sal_uInt32 nSize = pStrm->Tell();
pStrm->Seek( nPropOfs + nSecOfs ); pStrm->Seek( nPropOfs + nSecOfs );
nSize -= pStrm->Tell(); nSize -= pStrm->Tell();
if ( nSize > nStrmSize ) if ( nSize > nStrmSize )
...@@ -504,7 +507,7 @@ void Section::Read( SotStorageStream *pStrm ) ...@@ -504,7 +507,7 @@ void Section::Read( SotStorageStream *pStrm )
break; break;
} }
sal_uInt8* pBuf = new sal_uInt8[ nSize ]; sal_uInt8* pBuf = new sal_uInt8[ nSize ];
pStrm->Read( pBuf, nSize ); nSize = pStrm->Read(pBuf, nSize);
AddProperty( 0xffffffff, pBuf, nSize ); AddProperty( 0xffffffff, pBuf, nSize );
delete[] pBuf; delete[] pBuf;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment