summaryrefslogtreecommitdiff
path: root/sd/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-08-28 08:28:51 +0100
committerDavid Tardon <dtardon@redhat.com>2015-08-29 08:32:22 +0000
commitb45df6e4037556c3ee6ccdb4497762884fdb2327 (patch)
treefc6fd77ea56b9008b18976bd5a7b691351b01110 /sd/source
parentca9cbc1aa3458de7ce4893668476aa4433e6b0e0 (diff)
check seeks and reads
Change-Id: I0c5c4784713376e0762bfbd197640f8d31b65562 (cherry picked from commit 1847753ab135f522df6a293a8539155437f0129f) Reviewed-on: https://gerrit.libreoffice.org/18116 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'sd/source')
-rw-r--r--sd/source/filter/ppt/pptin.cxx29
-rw-r--r--sd/source/filter/ppt/propread.cxx21
2 files changed, 32 insertions, 18 deletions
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 5fe2bdc6d479..e5b15df50cb9 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -519,7 +519,8 @@ bool ImplSdPPTImport::Import()
break;
rStCtrl.SeekRel( 8 );
rStCtrl.ReadUInt32( pPtr->nIndex );
- aHyperE.SeekToEndOfRecord( rStCtrl );
+ if (!aHyperE.SeekToEndOfRecord(rStCtrl))
+ break;
}
}
}
@@ -818,7 +819,8 @@ bool ImplSdPPTImport::Import()
}
break;
}
- aProgTagContentHd.SeekToEndOfRecord( rStCtrl );
+ if (!aProgTagContentHd.SeekToEndOfRecord(rStCtrl))
+ break;
}
}
}
@@ -945,7 +947,8 @@ bool ImplSdPPTImport::Import()
case PPT_PST_SlideTime10Atom : // ??? don't know, this atom is always 8 bytes big
break; // and is appearing in nearly every l10 progtag
}
- aProgTagContentHd.SeekToEndOfRecord( rStCtrl );
+ if (!aProgTagContentHd.SeekToEndOfRecord(rStCtrl))
+ break;
}
}
}
@@ -957,7 +960,8 @@ bool ImplSdPPTImport::Import()
break;
}
- aHd.SeekToEndOfRecord( rStCtrl );
+ if (!aHd.SeekToEndOfRecord(rStCtrl))
+ break;
}
ImportPageEffect( (SdPage*)pPage, bNewAnimationsUsed );
}
@@ -1780,7 +1784,8 @@ void ImplSdPPTImport::ImportPageEffect( SdPage* pPage, const bool bNewAnimations
}
}
}
- aHd.SeekToEndOfRecord( rStCtrl );
+ if (!aHd.SeekToEndOfRecord(rStCtrl))
+ break;
}
if ( bTryTwice && ( bSSSlideInfoAtom == false ) )
{
@@ -1942,7 +1947,10 @@ OUString ImplSdPPTImport::ReadSound(sal_uInt32 nSoundRef) const
}
}
if ( !bDone )
- aSoundRecHd.SeekToEndOfRecord( rStCtrl );
+ {
+ if (!aSoundRecHd.SeekToEndOfRecord(rStCtrl))
+ break;
+ }
}
}
}
@@ -2002,7 +2010,8 @@ OUString ImplSdPPTImport::ReadMedia( sal_uInt32 nMediaRef ) const
}
break;
}
- aHd.SeekToEndOfRecord( rStCtrl );
+ if (!aHd.SeekToEndOfRecord(rStCtrl))
+ break;
}
break;
}
@@ -2011,7 +2020,8 @@ OUString ImplSdPPTImport::ReadMedia( sal_uInt32 nMediaRef ) const
}
break;
}
- aHdMovie.SeekToEndOfRecord( rStCtrl );
+ if (!aHdMovie.SeekToEndOfRecord(rStCtrl))
+ break;
}
}
return aRetVal;
@@ -2660,7 +2670,8 @@ SdrObject* ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
}
break;
}
- aHd.SeekToEndOfRecord( rSt );
+ if (!aHd.SeekToEndOfRecord(rSt))
+ break;
}
while( ( rSt.GetError() == 0 ) && ( rSt.Tell() < nClientDataLen ) );
diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx
index 8f376fd71d8d..54807efb3c0a 100644
--- a/sd/source/filter/ppt/propread.cxx
+++ b/sd/source/filter/ppt/propread.cxx
@@ -319,7 +319,7 @@ bool Section::GetDictionary( Dictionary& rDict )
void Section::Read( SvStorageStream *pStrm )
{
- sal_uInt32 i, nSecOfs, nPropSize, nStrmSize;
+ sal_uInt32 nSecOfs, nPropSize, nStrmSize;
nSecOfs = pStrm->Tell();
pStrm->Seek( STREAM_SEEK_TO_END );
@@ -357,7 +357,7 @@ void Section::Read( SvStorageStream *pStrm )
bool bVariant = ( nPropType == VT_VARIANT );
- for ( i = 0; nPropSize && ( i < nVectorCount ); i++ )
+ for (sal_uInt32 i = 0; nPropSize && ( i < nVectorCount ); ++i)
{
if ( bVariant )
{
@@ -453,7 +453,7 @@ void Section::Read( SvStorageStream *pStrm )
if( nPropSize > nSecSize - nSecOfs )
nPropSize = nSecSize - nSecOfs;
sal_uInt8* pBuf = new sal_uInt8[ nPropSize ];
- pStrm->Read( pBuf, nPropSize );
+ nPropSize = pStrm->Read(pBuf, nPropSize);
AddProperty( nPropId, pBuf, nPropSize );
delete[] pBuf;
}
@@ -488,14 +488,17 @@ void Section::Read( SvStorageStream *pStrm )
}
else
{
- sal_uInt32 nDictCount, nSize;
- pStrm->ReadUInt32( nDictCount );
- for ( i = 0; i < nDictCount; i++ )
+ sal_uInt32 nDictCount(0);
+ pStrm->ReadUInt32(nDictCount);
+ for (sal_uInt32 i = 0; i < nDictCount; ++i)
{
+ sal_uInt32 nSize(0);
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 );
nSize -= pStrm->Tell();
if ( nSize > nStrmSize )
@@ -504,7 +507,7 @@ void Section::Read( SvStorageStream *pStrm )
break;
}
sal_uInt8* pBuf = new sal_uInt8[ nSize ];
- pStrm->Read( pBuf, nSize );
+ nSize = pStrm->Read(pBuf, nSize);
AddProperty( 0xffffffff, pBuf, nSize );
delete[] pBuf;
}