[Libreoffice-commits] core.git: 5 commits - filter/source include/svx sd/qa sd/source svx/source
Caolán McNamara
caolanm at redhat.com
Fri Aug 28 12:07:01 PDT 2015
filter/source/msfilter/msdffimp.cxx | 28 +++++++--------
filter/source/msfilter/svdfppt.cxx | 62 ++++++++++++++++++++++++----------
include/svx/svdmark.hxx | 8 ++++
sd/qa/unit/data/ppt/pass/crash-2.ppt |binary
sd/qa/unit/data/ppt/pass/hang-15.ppt |binary
sd/qa/unit/data/ppt/pass/hang-16.ppt |binary
sd/qa/unit/data/ppt/pass/hang-17.ppt |binary
sd/qa/unit/data/ppt/pass/hang-19.ppt |binary
sd/qa/unit/data/ppt/pass/hang-20.ppt |binary
sd/source/filter/ppt/pptin.cxx | 63 +++++++++++++++++++++++++----------
sd/source/filter/ppt/propread.cxx | 32 +++++++++++------
svx/source/svdraw/svdedtv2.cxx | 18 ++++++++--
svx/source/svdraw/svdmark.cxx | 12 +++++-
13 files changed, 157 insertions(+), 66 deletions(-)
New commits:
commit dc1be62d75e654e17c2f4c02804b7fd48d5a2515
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Aug 28 16:14:07 2015 +0100
check stream status
Change-Id: I609c8c4f4e843601361b61f55e0325ad99db3c23
diff --git a/sd/qa/unit/data/ppt/pass/hang-20.ppt b/sd/qa/unit/data/ppt/pass/hang-20.ppt
new file mode 100644
index 0000000..7bfe75d
Binary files /dev/null and b/sd/qa/unit/data/ppt/pass/hang-20.ppt differ
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 530be9c..76f331d 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -280,7 +280,6 @@ bool ImplSdPPTImport::Import()
if ( nSlideCount && pSection->GetProperty( PID_HEADINGPAIR, aPropItem ) )
{
sal_uInt32 nSlideTitleIndex = 0, nSlideTitleCount = 0;
- sal_uInt32 i, nTemp;
OUString aUString;
@@ -291,13 +290,14 @@ bool ImplSdPPTImport::Import()
{
nVecCount >>= 1;
sal_uInt32 nEntryCount = 0;
- for ( i = 0; i < nVecCount; i++ )
+ for (sal_uInt32 i = 0; i < nVecCount; ++i)
{
if ( !aPropItem.Read( aUString, VT_EMPTY, false ) )
break;
aPropItem.ReadUInt32( nType );
if ( ( nType != VT_I4 ) && ( nType != VT_UI4 ) )
break;
+ sal_uInt32 nTemp(0);
aPropItem.ReadUInt32( nTemp );
if ( aUString == "Slide Titles" || aUString == "Folientitel" )
{
@@ -312,17 +312,33 @@ bool ImplSdPPTImport::Import()
aPropItem.ReadUInt32( nType )
.ReadUInt32( nVecCount );
- if ( ( nVecCount >= ( nSlideTitleIndex + nSlideTitleCount ) )
- && ( nType == ( VT_LPSTR | VT_VECTOR ) ) )
+ bool bVecOk = ( ( nVecCount >= (nSlideTitleIndex + nSlideTitleCount) )
+ && ( nType == ( VT_LPSTR | VT_VECTOR ) ) );
+
+ if (bVecOk)
{
- for ( i = 0; i != nSlideTitleIndex; i++ )
+ for (sal_uInt32 i = 0; i != nSlideTitleIndex; ++i)
{
- aPropItem.ReadUInt32( nTemp );
- aPropItem.SeekRel( nTemp );
+ sal_uInt32 nTemp(0);
+ aPropItem.ReadUInt32(nTemp);
+ if (!aPropItem.good())
+ {
+ bVecOk = false;
+ break;
+ }
+ auto nPos = aPropItem.Tell() + nTemp;
+ if (nPos != aPropItem.Seek(nPos))
+ {
+ bVecOk = false;
+ break;
+ }
}
- for ( i = 0; i < nSlideTitleCount; i++ )
+ }
+ if (bVecOk)
+ {
+ for (sal_uInt32 i = 0; i < nSlideTitleCount; ++i)
{
- if ( !aPropItem.Read( aUString, nType, false ) )
+ if (!aPropItem.Read(aUString, nType, false))
break;
OUString aString( aUString );
commit 078235028a8c4ea36b6b366348016e19759c456a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Aug 28 15:33:44 2015 +0100
eof isn't a Error, so use good not GetError
Change-Id: Ie1df87c7eb9d391d0fa4a579f744051a1f1b2ae1
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 011624a..a7f1ec7 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4170,17 +4170,17 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
SEEK_FROM_BEGINNING ) )
{
sal_uInt32 nBytesLeft = maShapeRecords.Current()->nRecLen;
- sal_uInt32 nUDData;
- sal_uInt16 nPID;
while( 5 < nBytesLeft )
{
- rSt.ReadUInt16( nPID );
- if ( rSt.GetError() != 0 )
+ sal_uInt16 nPID(0);
+ rSt.ReadUInt16(nPID);
+ if (!rSt.good())
break;
- rSt.ReadUInt32( nUDData );
- if ( rSt.GetError() != 0 )
+ sal_uInt32 nUDData(0);
+ rSt.ReadUInt32(nUDData);
+ if (!rSt.good())
break;
- if ( nPID == 447 )
+ if (nPID == 447)
{
mbRotateGranientFillWithAngle = nUDData & 0x20;
break;
@@ -5009,15 +5009,15 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
&& maShapeRecords.Current()->nRecLen )
{
sal_uInt32 nBytesLeft = maShapeRecords.Current()->nRecLen;
- sal_uInt32 nUDData;
- sal_uInt16 nPID;
while( 5 < nBytesLeft )
{
- rSt.ReadUInt16( nPID );
- if ( rSt.GetError() != 0 )
+ sal_uInt16 nPID(0);
+ rSt.ReadUInt16(nPID);
+ if (!rSt.good())
break;
- rSt.ReadUInt32( nUDData );
- switch( nPID )
+ sal_uInt32 nUDData(0);
+ rSt.ReadUInt32(nUDData);
+ switch (nPID)
{
case 0x038F: pImpRec->nXAlign = nUDData; break;
case 0x0390:
@@ -5045,7 +5045,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
pImpRec->isHorizontalRule = true;
break;
}
- if ( rSt.GetError() != 0 )
+ if (!rSt.good())
break;
nBytesLeft -= 6;
}
diff --git a/sd/qa/unit/data/ppt/pass/hang-19.ppt b/sd/qa/unit/data/ppt/pass/hang-19.ppt
new file mode 100644
index 0000000..942a58a
Binary files /dev/null and b/sd/qa/unit/data/ppt/pass/hang-19.ppt differ
commit 8c2b2d63eed861e8cfe847c4b3757b307e9d389e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Aug 28 15:13:41 2015 +0100
time stamp object selections and use newest as ref for equalization
Change-Id: I1bf22ddbaf263b240288f70d03d6949611f86b69
diff --git a/include/svx/svdmark.hxx b/include/svx/svdmark.hxx
index cba0a75..aee9dd7 100644
--- a/include/svx/svdmark.hxx
+++ b/include/svx/svdmark.hxx
@@ -42,7 +42,10 @@ typedef std::set<sal_uInt16> SdrUShortCont;
*/
class SVX_DLLPUBLIC SdrMark : public sdr::ObjectUser
{
+private:
+ void setTime();
protected:
+ sal_Int64 mnTimeStamp;
SdrObject* mpSelectedSdrObject; // the selected object
SdrPageView* mpPageView;
SdrUShortCont* mpPoints; // Selected Points
@@ -145,6 +148,11 @@ public:
return mpGluePoints;
}
+
+ sal_Int64 getTimeStamp() const
+ {
+ return mnTimeStamp;
+ }
};
class SVX_DLLPUBLIC SdrMarkList
diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx
index 719355d..090efa7 100644
--- a/svx/source/svdraw/svdedtv2.cxx
+++ b/svx/source/svdraw/svdedtv2.cxx
@@ -1181,7 +1181,19 @@ void SdrEditView::EqualizeMarkedObjects(bool bWidth)
if (nMarked < 2)
return;
- SdrObject* pLastSelectedObj = rMarkList.GetMark(nMarked-1)->GetMarkedSdrObj();
+ size_t nLastSelected = 0;
+ sal_Int64 nLastSelectedTime = rMarkList.GetMark(0)->getTimeStamp();
+ for (size_t a = 1; a < nMarked; ++a)
+ {
+ sal_Int64 nCandidateTime = rMarkList.GetMark(a)->getTimeStamp();
+ if (nCandidateTime > nLastSelectedTime)
+ {
+ nLastSelectedTime = nCandidateTime;
+ nLastSelected = a;
+ }
+ }
+
+ SdrObject* pLastSelectedObj = rMarkList.GetMark(nLastSelected)->GetMarkedSdrObj();
Size aLastRectSize(pLastSelectedObj->GetLogicRect().GetSize());
const bool bUndo = IsUndoEnabled();
@@ -1189,8 +1201,10 @@ void SdrEditView::EqualizeMarkedObjects(bool bWidth)
if (bUndo)
BegUndo();
- for (size_t a = 0; a < nMarked-1; ++a)
+ for (size_t a = 0; a < nMarked; ++a)
{
+ if (a == nLastSelected)
+ continue;
SdrMark* pM = rMarkList.GetMark(a);
SdrObject* pObj = pM->GetMarkedSdrObj();
Rectangle aLogicRect(pObj->GetLogicRect());
diff --git a/svx/source/svdraw/svdmark.cxx b/svx/source/svdraw/svdmark.cxx
index 7ddde61..8b7f3e09c 100644
--- a/svx/source/svdraw/svdmark.cxx
+++ b/svx/source/svdraw/svdmark.cxx
@@ -38,8 +38,12 @@
#include <svl/SfxBroadcaster.hxx>
#include <svx/svdoedge.hxx>
-
-
+void SdrMark::setTime()
+{
+ TimeValue aNow;
+ osl_getSystemTime(&aNow);
+ mnTimeStamp = sal_Int64(aNow.Seconds) * 1000000000L + aNow.Nanosec;
+}
SdrMark::SdrMark(SdrObject* pNewObj, SdrPageView* pNewPageView)
: mpSelectedSdrObject(pNewObj),
@@ -55,10 +59,12 @@ SdrMark::SdrMark(SdrObject* pNewObj, SdrPageView* pNewPageView)
{
mpSelectedSdrObject->AddObjectUser( *this );
}
+ setTime();
}
SdrMark::SdrMark(const SdrMark& rMark)
: ObjectUser(),
+ mnTimeStamp(0),
mpSelectedSdrObject(0L),
mpPageView(0L),
mpPoints(0L),
@@ -117,10 +123,10 @@ void SdrMark::SetMarkedSdrObj(SdrObject* pNewObj)
}
}
-
SdrMark& SdrMark::operator=(const SdrMark& rMark)
{
SetMarkedSdrObj(rMark.mpSelectedSdrObject);
+ mnTimeStamp = rMark.mnTimeStamp;
mpPageView = rMark.mpPageView;
mbCon1 = rMark.mbCon1;
mbCon2 = rMark.mbCon2;
commit 2aadad1e89e96cb80c15fe1069cb6365f0cade1d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Aug 28 14:33:05 2015 +0100
guard against 0 item size
Change-Id: I9c4c2f0fe2d892615b3c70e08da0cab6da13338a
diff --git a/sd/qa/unit/data/ppt/pass/crash-2.ppt b/sd/qa/unit/data/ppt/pass/crash-2.ppt
new file mode 100644
index 0000000..78a4da4
Binary files /dev/null and b/sd/qa/unit/data/ppt/pass/crash-2.ppt differ
diff --git a/sd/source/filter/ppt/propread.cxx b/sd/source/filter/ppt/propread.cxx
index 286c61f..18f3450 100644
--- a/sd/source/filter/ppt/propread.cxx
+++ b/sd/source/filter/ppt/propread.cxx
@@ -93,7 +93,7 @@ bool PropItem::Read( OUString& rString, sal_uInt32 nStringType, bool bAlign )
{
case VT_LPSTR :
{
- if ( nItemSize )
+ if (nItemSize)
{
auto nMaxSizePossible = remainingSize();
if (nItemSize > nMaxSizePossible)
@@ -101,6 +101,10 @@ bool PropItem::Read( OUString& rString, sal_uInt32 nStringType, bool bAlign )
SAL_WARN("sd.filter", "String of Len " << nItemSize << " claimed, only " << nMaxSizePossible << " possible");
nItemSize = nMaxSizePossible;
}
+ }
+
+ if (nItemSize)
+ {
try
{
sal_Char* pString = new sal_Char[ nItemSize ];
@@ -144,7 +148,7 @@ bool PropItem::Read( OUString& rString, sal_uInt32 nStringType, bool bAlign )
case VT_LPWSTR :
{
- if ( nItemSize )
+ if (nItemSize)
{
auto nMaxSizePossible = remainingSize() / sizeof(sal_Unicode);
if (nItemSize > nMaxSizePossible)
@@ -152,7 +156,10 @@ bool PropItem::Read( OUString& rString, sal_uInt32 nStringType, bool bAlign )
SAL_WARN("sd.filter", "String of Len " << nItemSize << " claimed, only " << nMaxSizePossible << " possible");
nItemSize = nMaxSizePossible;
}
+ }
+ if (nItemSize)
+ {
try
{
sal_Unicode* pString = new sal_Unicode[ nItemSize ];
commit 1847753ab135f522df6a293a8539155437f0129f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Aug 28 08:28:51 2015 +0100
check seeks and reads
Change-Id: I0c5c4784713376e0762bfbd197640f8d31b65562
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index b025b79..ad20a86 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -786,7 +786,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 )
@@ -1810,7 +1811,10 @@ SdrObject* SdrPowerPointImport::ImportOLE( long nOLEId,
break;
}
else
- aPlaceHd.SeekToEndOfRecord( rStCtrl );
+ {
+ if (!aPlaceHd.SeekToEndOfRecord(rStCtrl))
+ break;
+ }
}
}
@@ -2402,7 +2406,8 @@ bool SdrPowerPointImport::SeekToContentOfProgTag( sal_Int32 nVersion, SvStream&
}
}
}
- aProgTagBinaryDataHd.SeekToEndOfRecord( rSt );
+ if (!aProgTagBinaryDataHd.SeekToEndOfRecord(rSt))
+ break;
}
}
if ( !bRetValue )
@@ -2703,7 +2708,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 );
@@ -2763,7 +2769,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;
}
}
}
@@ -2841,7 +2848,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
@@ -2891,7 +2899,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 )
@@ -2907,7 +2916,8 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry*
}
break;
}
- aHd.SeekToEndOfRecord( rStCtrl );
+ if (!aHd.SeekToEndOfRecord(rStCtrl))
+ break;
}
if ( rSlidePersist.pSolverContainer )
SolveSolver( *rSlidePersist.pSolverContainer );
@@ -3116,7 +3126,8 @@ void SdrEscherImport::ImportHeaderFooterContainer( DffRecordHeader& rHd, HeaderF
}
break;
}
- aHd.SeekToEndOfRecord( rStCtrl );
+ if (!aHd.SeekToEndOfRecord(rStCtrl))
+ break;
}
}
@@ -3246,7 +3257,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;
@@ -3270,7 +3282,8 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const
break;
#endif
}
- aHd.SeekToEndOfRecord( rSt );
+ if (!aHd.SeekToEndOfRecord(rSt))
+ break;
}
}
@@ -3319,7 +3332,8 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const
case 0xf144 :
break;
}
- aHd.SeekToEndOfRecord( rSt );
+ if (!aHd.SeekToEndOfRecord(rSt))
+ break;
}
}
rSt.Seek( nOldPos );
@@ -4096,7 +4110,10 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd
break;
}
else
- aTxMasterStyleHd.SeekToEndOfRecord( rIn );
+ {
+ if (!aTxMasterStyleHd.SeekToEndOfRecord(rIn))
+ break;
+ }
}
}
@@ -4110,7 +4127,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
{
@@ -4212,7 +4232,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 ] )
@@ -4285,7 +4306,10 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd
break;
}
else
- aTxMasterStyleHd2.SeekToEndOfRecord( rIn );
+ {
+ if (!aTxMasterStyleHd2.SeekToEndOfRecord(rIn))
+ break;
+ }
}
}
}
@@ -6480,7 +6504,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 )
{
@@ -6810,7 +6835,8 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
}
break;
}
- aTextHd.SeekToEndOfRecord( rIn );
+ if (!aTextHd.SeekToEndOfRecord(rIn))
+ break;
if ( pEntry )
{
// sorting fields ( hi >> lo )
diff --git a/sd/qa/unit/data/ppt/pass/hang-15.ppt b/sd/qa/unit/data/ppt/pass/hang-15.ppt
new file mode 100644
index 0000000..b93255a
Binary files /dev/null and b/sd/qa/unit/data/ppt/pass/hang-15.ppt differ
diff --git a/sd/qa/unit/data/ppt/pass/hang-16.ppt b/sd/qa/unit/data/ppt/pass/hang-16.ppt
new file mode 100644
index 0000000..c398d2b
Binary files /dev/null and b/sd/qa/unit/data/ppt/pass/hang-16.ppt differ
diff --git a/sd/qa/unit/data/ppt/pass/hang-17.ppt b/sd/qa/unit/data/ppt/pass/hang-17.ppt
new file mode 100644
index 0000000..de876ff
Binary files /dev/null and b/sd/qa/unit/data/ppt/pass/hang-17.ppt differ
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 31fe108..530be9c 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 64e3725..286c61f 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;
}
More information about the Libreoffice-commits
mailing list