summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-08-27 14:22:23 +0100
committerAndras Timar <andras.timar@collabora.com>2015-08-31 15:11:58 +0200
commitac382ac7525348874bb1231f90b99814849eecd9 (patch)
tree971d7fcf0b7552262ea03a5628bca2b6b0aeb93c /filter
parentfbe1fbe3db1036dd8e1cc4c54c7fef6647f8064e (diff)
avoid loops in atom chains
(cherry picked from commit de71eae5807ff94c8eace0eccaabf1ffa08e77b6) Change-Id: Icc40c0ee6c7d8d305cf7cc60cbf3e511c763aedd Reviewed-on: https://gerrit.libreoffice.org/18093 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/msfilter/svdfppt.cxx18
1 files changed, 15 insertions, 3 deletions
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 1e8f49d7fac3..d3bb6b78a9bf 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -2552,11 +2552,17 @@ bool SdrPowerPointImport::GetColorFromPalette( sal_uInt16 nNum, Color& rColor )
while( ( pMasterPersist && pMasterPersist->aSlideAtom.nFlags & 2 ) // it is possible that a masterpage
&& pMasterPersist->aSlideAtom.nMasterId ) // itself is following a master colorscheme
{
- sal_uInt16 nNextMaster = pMasterPages->FindPage( pMasterPersist->aSlideAtom.nMasterId );
+ auto nOrigMasterId = pMasterPersist->aSlideAtom.nMasterId;
+ sal_uInt16 nNextMaster = pMasterPages->FindPage(nOrigMasterId);
if ( nNextMaster == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
break;
else
pMasterPersist = &(*pPageList2)[ nNextMaster ];
+ if (pMasterPersist->aSlideAtom.nMasterId == nOrigMasterId)
+ {
+ SAL_WARN("filter.ms", "loop in atom chain");
+ break;
+ }
}
}
if ( pMasterPersist )
@@ -2565,7 +2571,7 @@ bool SdrPowerPointImport::GetColorFromPalette( sal_uInt16 nNum, Color& rColor )
}
}
}
- // resgister current color scheme
+ // register current color scheme
const_cast<SdrPowerPointImport*>(this)->nPageColorsNum = nAktPageNum;
const_cast<SdrPowerPointImport*>(this)->ePageColorsKind = eAktPageKind;
}
@@ -2789,11 +2795,17 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry*
PptSlidePersistEntry* pE = &(*pPageList)[ nMasterNum ];
while( ( pE->aSlideAtom.nFlags & 4 ) && pE->aSlideAtom.nMasterId )
{
- sal_uInt16 nNextMaster = pMasterPages->FindPage( pE->aSlideAtom.nMasterId );
+ auto nOrigMasterId = pE->aSlideAtom.nMasterId;
+ sal_uInt16 nNextMaster = pMasterPages->FindPage(nOrigMasterId);
if ( nNextMaster == PPTSLIDEPERSIST_ENTRY_NOTFOUND )
break;
else
pE = &(*pPageList)[ nNextMaster ];
+ if (pE->aSlideAtom.nMasterId == nOrigMasterId)
+ {
+ SAL_WARN("filter.ms", "loop in atom chain");
+ break;
+ }
}
if ( pE->nBackgroundOffset )
{