diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-08-28 08:28:51 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-08-31 15:12:04 +0200 |
commit | c31be2d0d4deed0e1a060954bb0ff9627fd1716d (patch) | |
tree | d3243a7bcaf14846ac90f260a7ed5cacca25ed63 /filter | |
parent | 94a0e0126fc5fba02b965b24b248f48bc2358670 (diff) |
check seeks and reads
Change-Id: I0c5c4784713376e0762bfbd197640f8d31b65562
(cherry picked from commit 1847753ab135f522df6a293a8539155437f0129f)
Reviewed-on: https://gerrit.libreoffice.org/18112
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/msfilter/svdfppt.cxx | 62 |
1 files changed, 44 insertions, 18 deletions
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 0ac8030d4285..42f8b1bcb3ec 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -785,7 +785,8 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi } break; } - aClientDataHd.SeekToEndOfRecord( rSt ); + if (!aClientDataHd.SeekToEndOfRecord(rSt)) + break; } } if ( ( aPlaceholderAtom.nPlaceholderId == PptPlaceholder::NOTESSLIDEIMAGE ) && !rPersistEntry.bNotesMaster ) @@ -1809,7 +1810,10 @@ SdrObject* SdrPowerPointImport::ImportOLE( long nOLEId, break; } else - aPlaceHd.SeekToEndOfRecord( rStCtrl ); + { + if (!aPlaceHd.SeekToEndOfRecord(rStCtrl)) + break; + } } } @@ -2401,7 +2405,8 @@ bool SdrPowerPointImport::SeekToContentOfProgTag( sal_Int32 nVersion, SvStream& } } } - aProgTagBinaryDataHd.SeekToEndOfRecord( rSt ); + if (!aProgTagBinaryDataHd.SeekToEndOfRecord(rSt)) + break; } } if ( !bRetValue ) @@ -2702,7 +2707,8 @@ void ImportComment10( SvxMSDffManager& rMan, SvStream& rStCtrl, SdrPage* pPage, } break; } - aCommentHd.SeekToEndOfRecord( rStCtrl ); + if (!aCommentHd.SeekToEndOfRecord(rStCtrl)) + break; } Point aPosition( nPosX, nPosY ); rMan.Scale( aPosition ); @@ -2762,7 +2768,8 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry* while( ( rStCtrl.GetError() == 0 ) && SeekToRec( rStCtrl, PPT_PST_Comment10, aContentDataHd.GetRecEndFilePos(), &aComment10Hd ) ) { ImportComment10( *this, rStCtrl, pRet, aComment10Hd ); - aComment10Hd.SeekToEndOfRecord( rStCtrl ); + if (!aComment10Hd.SeekToEndOfRecord(rStCtrl)) + break; } } } @@ -2840,7 +2847,8 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry* } if ( aEscherObjListHd.nRecType == DFF_msofbtSpContainer ) break; - aEscherObjListHd.SeekToEndOfRecord( rStCtrl ); + if (!aEscherObjListHd.SeekToEndOfRecord(rStCtrl)) + break; } // now importing page @@ -2890,7 +2898,8 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry* } if ( aEscherObjListHd.nRecType == DFF_msofbtSpgrContainer ) break; - aEscherObjListHd.SeekToEndOfRecord( rStCtrl ); + if (!aEscherObjListHd.SeekToEndOfRecord(rStCtrl)) + break; } if ( rSlidePersist.pBObj ) @@ -2906,7 +2915,8 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry* } break; } - aHd.SeekToEndOfRecord( rStCtrl ); + if (!aHd.SeekToEndOfRecord(rStCtrl)) + break; } if ( rSlidePersist.pSolverContainer ) SolveSolver( *rSlidePersist.pSolverContainer ); @@ -3126,7 +3136,8 @@ void SdrEscherImport::ImportHeaderFooterContainer( DffRecordHeader& rHd, HeaderF } break; } - aHd.SeekToEndOfRecord( rStCtrl ); + if (!aHd.SeekToEndOfRecord(rStCtrl)) + break; } } @@ -3256,7 +3267,8 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const #ifdef DBG_UTIL else OSL_FAIL( "PPTExParaProv::PPTExParaProv - unknown atom interpreting the PPT_PST_ExtendedBuGraContainer (SJ)" ); #endif - aBuGraAtomHd.SeekToEndOfRecord( rSt ); + if (!aBuGraAtomHd.SeekToEndOfRecord(rSt)) + break; } if ( !aBuGraList.empty() ) bGraphics = true; @@ -3280,7 +3292,8 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const break; #endif } - aHd.SeekToEndOfRecord( rSt ); + if (!aHd.SeekToEndOfRecord(rSt)) + break; } } @@ -3329,7 +3342,8 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const case 0xf144 : break; } - aHd.SeekToEndOfRecord( rSt ); + if (!aHd.SeekToEndOfRecord(rSt)) + break; } } rSt.Seek( nOldPos ); @@ -4106,7 +4120,10 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd break; } else - aTxMasterStyleHd.SeekToEndOfRecord( rIn ); + { + if (!aTxMasterStyleHd.SeekToEndOfRecord(rIn)) + break; + } } } @@ -4120,7 +4137,10 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd if ( aTxMasterStyleHd.nRecType == PPT_PST_TxMasterStyleAtom ) break; else - aTxMasterStyleHd.SeekToEndOfRecord( rIn ); + { + if (!aTxMasterStyleHd.SeekToEndOfRecord(rIn)) + break; + } } while ( ( aTxMasterStyleHd.nRecType == PPT_PST_TxMasterStyleAtom ) && ( rIn.Tell() < nEndRecPos ) ) //TODO: aTxMasterStyleHd may be used without having been properly initialized { @@ -4222,7 +4242,8 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd } #endif } - aTxMasterStyleHd.SeekToEndOfRecord( rIn ); + if (!aTxMasterStyleHd.SeekToEndOfRecord(rIn)) + break; ReadDffRecordHeader( rIn, aTxMasterStyleHd ); } if ( !mpCharSheet[ TSS_TYPE_SUBTITLE ] ) @@ -4295,7 +4316,10 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd break; } else - aTxMasterStyleHd2.SeekToEndOfRecord( rIn ); + { + if (!aTxMasterStyleHd2.SeekToEndOfRecord(rIn)) + break; + } } } } @@ -6501,7 +6525,8 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport if ( ( nTmpSlideId == nSlideId ) && ( pHd->nRecInstance == nRefNum ) ) { - pHd->SeekToEndOfRecord( rIn ); + if (!pHd->SeekToEndOfRecord(rIn)) + break; ReadDffRecordHeader( rIn, aPresRuleHd ); if ( aPresRuleHd.nRecType == PPT_PST_ExtendedParagraphAtom ) { @@ -6831,7 +6856,8 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport } break; } - aTextHd.SeekToEndOfRecord( rIn ); + if (!aTextHd.SeekToEndOfRecord(rIn)) + break; if ( pEntry ) { // sorting fields ( hi >> lo ) |