summaryrefslogtreecommitdiff
path: root/sd/source/filter/ppt
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-08-27 09:13:42 +0100
committerAndras Timar <andras.timar@collabora.com>2015-08-31 13:53:03 +0200
commitaecf1513a7b28b6e0127c2f142d6f601b92c694b (patch)
tree5ca0acf992fef1f969b850fbd47ca35947df926a /sd/source/filter/ppt
parentb459a9d9700255ea0b6baabacfa3582a3d745ac5 (diff)
extend seek, loop ending tests to ppt specific code
(cherry picked from commit c249f93d96ec87b0acbd25ffe087543d6fe9fb14) Change-Id: Id4419b6b902b742117e248870b6a663c9c58955f Reviewed-on: https://gerrit.libreoffice.org/18053 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'sd/source/filter/ppt')
-rw-r--r--sd/source/filter/ppt/pptin.cxx35
1 files changed, 21 insertions, 14 deletions
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 06a89e615bcc..57f1c2336c6f 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -741,7 +741,8 @@ bool ImplSdPPTImport::Import()
DffRecordHeader aPageHd;
if ( SeekToAktPage( &aPageHd ) )
{
- while( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aPageHd.GetRecEndFilePos() ) )
+ auto nEndRecPos = SanitizeEndPos(rStCtrl, aPageHd.GetRecEndFilePos());
+ while( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < nEndRecPos ) )
{
DffRecordHeader aHd;
ReadDffRecordHeader( rStCtrl, aHd );
@@ -762,7 +763,8 @@ bool ImplSdPPTImport::Import()
if ( SeekToRec( rStCtrl, DFF_msofbtSpgrContainer, nEscherF002End, &aEscherObjListHd ) )
{
sal_uInt32 nObjCount = 0;
- while( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aEscherObjListHd.GetRecEndFilePos() ) )
+ auto nListEndRecPos = SanitizeEndPos(rStCtrl, aEscherObjListHd.GetRecEndFilePos());
+ while( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < nListEndRecPos ) )
{
DffRecordHeader aHd2;
ReadDffRecordHeader( rStCtrl, aHd2 );
@@ -793,7 +795,8 @@ bool ImplSdPPTImport::Import()
DffRecordHeader aProgTagHd;
if ( SeekToContentOfProgTag( 10, rStCtrl, aPageHd, aProgTagHd ) )
{
- while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aProgTagHd.GetRecEndFilePos() ) )
+ auto nTagEndRecPos = SanitizeEndPos(rStCtrl, aProgTagHd.GetRecEndFilePos());
+ while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < nTagEndRecPos ) )
{
DffRecordHeader aProgTagContentHd;
ReadDffRecordHeader( rStCtrl, aProgTagContentHd );
@@ -901,7 +904,8 @@ bool ImplSdPPTImport::Import()
if ( SeekToAktPage( &aPageHd ) )
{
aPageHd.SeekToContent( rStCtrl );
- while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aPageHd.GetRecEndFilePos() ) )
+ auto nEndRecPos = SanitizeEndPos(rStCtrl, aPageHd.GetRecEndFilePos());
+ while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < nEndRecPos ) )
{
DffRecordHeader aHd;
ReadDffRecordHeader( rStCtrl, aHd );
@@ -912,7 +916,8 @@ bool ImplSdPPTImport::Import()
DffRecordHeader aProgTagHd;
if ( SeekToContentOfProgTag( 10, rStCtrl, aPageHd, aProgTagHd ) )
{
- while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < aProgTagHd.GetRecEndFilePos() ) )
+ auto nHdEndRecPos = SanitizeEndPos(rStCtrl, aProgTagHd.GetRecEndFilePos());
+ while ( ( rStCtrl.GetError() == 0 ) && ( rStCtrl.Tell() < nHdEndRecPos ) )
{
DffRecordHeader aProgTagContentHd;
ReadDffRecordHeader( rStCtrl, aProgTagContentHd );
@@ -1488,7 +1493,7 @@ void ImplSdPPTImport::ImportPageEffect( SdPage* pPage, const bool bNewAnimations
DffRecordHeader aPageRecHd;
if ( SeekToAktPage( &aPageRecHd ) )
{
- sal_uLong nPageRecEnd = aPageRecHd.GetRecEndFilePos();
+ sal_uLong nPageRecEnd = SanitizeEndPos(rStCtrl, aPageRecHd.GetRecEndFilePos());
bool bTryTwice = ( eAktPageKind == PPT_SLIDEPAGE );
bool bSSSlideInfoAtom = false;
@@ -1781,12 +1786,12 @@ void ImplSdPPTImport::ImportPageEffect( SdPage* pPage, const bool bNewAnimations
assert( !pPageList->is_null( nMasterNum ) );
const PptSlidePersistEntry& rE = (*pPageList)[ nMasterNum ];
sal_uInt32 nOfs = rE.aPersistAtom.nReserved;
- if ( nOfs )
- {
- rStCtrl.Seek( nOfs );
- nPageRecEnd = nOfs + 16;
- continue;
- }
+ if ( nOfs )
+ {
+ rStCtrl.Seek( nOfs );
+ nPageRecEnd = nOfs + 16;
+ continue;
+ }
}
}
@@ -1945,7 +1950,8 @@ OUString ImplSdPPTImport::ReadMedia( sal_uInt32 nMediaRef ) const
if ( pHd )
{
pHd->SeekToContent( rStCtrl );
- while ( ( rStCtrl.Tell() < pHd->GetRecEndFilePos() ) && aRetVal.isEmpty() )
+ auto nEndRecPos = SanitizeEndPos(rStCtrl, pHd->GetRecEndFilePos());
+ while ( ( rStCtrl.Tell() < nEndRecPos ) && aRetVal.isEmpty() )
{
DffRecordHeader aHdMovie;
ReadDffRecordHeader( rStCtrl, aHdMovie );
@@ -1965,7 +1971,8 @@ OUString ImplSdPPTImport::ReadMedia( sal_uInt32 nMediaRef ) const
if ( nRef == nMediaRef )
{
aExVideoHd.SeekToContent( rStCtrl );
- while( rStCtrl.Tell() < aExVideoHd.GetRecEndFilePos() )
+ auto nHdEndRecPos = SanitizeEndPos(rStCtrl, aExVideoHd.GetRecEndFilePos());
+ while (rStCtrl.Tell() < nHdEndRecPos)
{
DffRecordHeader aHd;
ReadDffRecordHeader( rStCtrl, aHd );