diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-08-28 08:28:51 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-08-28 20:06:36 +0100 |
commit | 1847753ab135f522df6a293a8539155437f0129f (patch) | |
tree | 28f3b24a61c54e03922006e7bd41ea54694da368 /sd | |
parent | 894151e80f27c84113b571dda3479ad4b2525686 (diff) |
check seeks and reads
Change-Id: I0c5c4784713376e0762bfbd197640f8d31b65562
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/ppt/pass/hang-15.ppt | bin | 0 -> 7680 bytes | |||
-rw-r--r-- | sd/qa/unit/data/ppt/pass/hang-16.ppt | bin | 0 -> 7693 bytes | |||
-rw-r--r-- | sd/qa/unit/data/ppt/pass/hang-17.ppt | bin | 0 -> 7680 bytes | |||
-rw-r--r-- | sd/source/filter/ppt/pptin.cxx | 29 | ||||
-rw-r--r-- | sd/source/filter/ppt/propread.cxx | 21 |
5 files changed, 32 insertions, 18 deletions
diff --git a/sd/qa/unit/data/ppt/pass/hang-15.ppt b/sd/qa/unit/data/ppt/pass/hang-15.ppt Binary files differnew file mode 100644 index 000000000000..b93255a7fd1c --- /dev/null +++ b/sd/qa/unit/data/ppt/pass/hang-15.ppt diff --git a/sd/qa/unit/data/ppt/pass/hang-16.ppt b/sd/qa/unit/data/ppt/pass/hang-16.ppt Binary files differnew file mode 100644 index 000000000000..c398d2ba1ebb --- /dev/null +++ b/sd/qa/unit/data/ppt/pass/hang-16.ppt diff --git a/sd/qa/unit/data/ppt/pass/hang-17.ppt b/sd/qa/unit/data/ppt/pass/hang-17.ppt Binary files differnew file mode 100644 index 000000000000..de876ff37e7c --- /dev/null +++ b/sd/qa/unit/data/ppt/pass/hang-17.ppt diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index 31fe108508a3..530be9c158d1 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -521,7 +521,8 @@ bool ImplSdPPTImport::Import() break; rStCtrl.SeekRel( 8 ); rStCtrl.ReadUInt32( pPtr->nIndex ); - aHyperE.SeekToEndOfRecord( rStCtrl ); + if (!aHyperE.SeekToEndOfRecord(rStCtrl)) + break; } } } @@ -826,7 +827,8 @@ bool ImplSdPPTImport::Import() } break; } - aProgTagContentHd.SeekToEndOfRecord( rStCtrl ); + if (!aProgTagContentHd.SeekToEndOfRecord(rStCtrl)) + break; } } } @@ -953,7 +955,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; } } } @@ -965,7 +968,8 @@ bool ImplSdPPTImport::Import() break; } - aHd.SeekToEndOfRecord( rStCtrl ); + if (!aHd.SeekToEndOfRecord(rStCtrl)) + break; } ImportPageEffect( pPage, bNewAnimationsUsed ); } @@ -1786,7 +1790,8 @@ void ImplSdPPTImport::ImportPageEffect( SdPage* pPage, const bool bNewAnimations } } } - aHd.SeekToEndOfRecord( rStCtrl ); + if (!aHd.SeekToEndOfRecord(rStCtrl)) + break; } if ( bTryTwice && !bSSSlideInfoAtom ) { @@ -1948,7 +1953,10 @@ OUString ImplSdPPTImport::ReadSound(sal_uInt32 nSoundRef) const } } if ( !bDone ) - aSoundRecHd.SeekToEndOfRecord( rStCtrl ); + { + if (!aSoundRecHd.SeekToEndOfRecord(rStCtrl)) + break; + } } } } @@ -2009,7 +2017,8 @@ OUString ImplSdPPTImport::ReadMedia( sal_uInt32 nMediaRef ) const } break; } - aHd.SeekToEndOfRecord( rStCtrl ); + if (!aHd.SeekToEndOfRecord(rStCtrl)) + break; } break; } @@ -2018,7 +2027,8 @@ OUString ImplSdPPTImport::ReadMedia( sal_uInt32 nMediaRef ) const } break; } - aHdMovie.SeekToEndOfRecord( rStCtrl ); + if (!aHdMovie.SeekToEndOfRecord(rStCtrl)) + break; } } return aRetVal; @@ -2676,7 +2686,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 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; } |