summaryrefslogtreecommitdiff
path: root/sd/source/filter/ppt/propread.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-08-28 08:28:51 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-08-28 20:06:36 +0100
commit1847753ab135f522df6a293a8539155437f0129f (patch)
tree28f3b24a61c54e03922006e7bd41ea54694da368 /sd/source/filter/ppt/propread.cxx
parent894151e80f27c84113b571dda3479ad4b2525686 (diff)
check seeks and reads
Change-Id: I0c5c4784713376e0762bfbd197640f8d31b65562
Diffstat (limited to 'sd/source/filter/ppt/propread.cxx')
-rw-r--r--sd/source/filter/ppt/propread.cxx21
1 files changed, 12 insertions, 9 deletions
diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx
index 64e37253eac2..286c61f83231 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( SotStorageStream *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( SotStorageStream *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( SotStorageStream *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( SotStorageStream *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( SotStorageStream *pStrm )
break;
}
sal_uInt8* pBuf = new sal_uInt8[ nSize ];
- pStrm->Read( pBuf, nSize );
+ nSize = pStrm->Read(pBuf, nSize);
AddProperty( 0xffffffff, pBuf, nSize );
delete[] pBuf;
}