diff options
-rw-r--r-- | sd/qa/unit/data/ppt/pass/hang-4.ppt | bin | 0 -> 7712 bytes | |||
-rw-r--r-- | sd/source/filter/ppt/propread.cxx | 25 |
2 files changed, 15 insertions, 10 deletions
diff --git a/sd/qa/unit/data/ppt/pass/hang-4.ppt b/sd/qa/unit/data/ppt/pass/hang-4.ppt Binary files differnew file mode 100644 index 000000000000..f5aa24752180 --- /dev/null +++ b/sd/qa/unit/data/ppt/pass/hang-4.ppt diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx index 2312081f54ec..f8804fd8f601 100644 --- a/sd/source/filter/ppt/propread.cxx +++ b/sd/source/filter/ppt/propread.cxx @@ -306,7 +306,7 @@ bool Section::GetDictionary( Dictionary& rDict ) void Section::Read( SotStorageStream *pStrm ) { - sal_uInt32 i, nSecOfs, nPropType, nPropSize, nCurrent, nVectorCount, nTemp, nStrmSize; + sal_uInt32 i, nSecOfs, nPropSize, nStrmSize; nSecOfs = pStrm->Tell(); pStrm->Seek( STREAM_SEEK_TO_END ); @@ -316,16 +316,20 @@ void Section::Read( SotStorageStream *pStrm ) mnTextEnc = RTL_TEXTENCODING_MS_1252; sal_uInt32 nSecSize(0), nPropCount(0); pStrm->ReadUInt32( nSecSize ).ReadUInt32( nPropCount ); - while (nPropCount-- && pStrm->good()) + while (nPropCount--) { sal_uInt32 nPropId(0), nPropOfs(0); - pStrm->ReadUInt32( nPropId ).ReadUInt32( nPropOfs ); - nCurrent = pStrm->Tell(); - pStrm->Seek( nPropOfs + nSecOfs ); + pStrm->ReadUInt32(nPropId).ReadUInt32(nPropOfs); + if (!pStrm->good()) + break; + auto nCurrent = pStrm->Tell(); + sal_uInt64 nOffset = nPropOfs + nSecOfs; + if (nOffset != pStrm->Seek(nOffset)) + break; if ( nPropId ) // do not read dictionary { - - pStrm->ReadUInt32( nPropType ); + sal_uInt32 nPropType(0), nVectorCount(0); + pStrm->ReadUInt32(nPropType); nPropSize = 4; @@ -347,6 +351,7 @@ void Section::Read( SotStorageStream *pStrm ) pStrm->ReadUInt32( nPropType ); nPropSize += 4; } + sal_uInt32 nTemp(0); switch( nPropType ) { case VT_UI1 : @@ -440,11 +445,11 @@ void Section::Read( SotStorageStream *pStrm ) PropItem aPropItem; if ( GetProperty( 1, aPropItem ) ) { - sal_uInt16 nCodePage; aPropItem.ReadUInt32( nPropType ); if ( nPropType == VT_I2 ) { - aPropItem.ReadUInt16( nCodePage ); + sal_uInt16 nCodePage(0); + aPropItem.ReadUInt16(nCodePage); if ( nCodePage == 1200 ) { @@ -486,7 +491,7 @@ void Section::Read( SotStorageStream *pStrm ) AddProperty( 0xffffffff, pBuf, nSize ); delete[] pBuf; } - pStrm->Seek( nCurrent ); + pStrm->Seek(nCurrent); } pStrm->Seek( nSecOfs + nSecSize ); } |