diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-08-27 14:22:23 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-08-28 11:25:53 +0000 |
commit | f6e85ec2eb9263e804098aeade75bd9fe8f39b27 (patch) | |
tree | 8dd87c9ee345b916c2cb7d68e352a6f7a7f94115 /filter | |
parent | 352b5eae4ea9c07d4fab595e75f73b44def7ab77 (diff) |
avoid loops in atom chains
(cherry picked from commit de71eae5807ff94c8eace0eccaabf1ffa08e77b6)
Change-Id: Icc40c0ee6c7d8d305cf7cc60cbf3e511c763aedd
Reviewed-on: https://gerrit.libreoffice.org/18080
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.cxx | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 9a5ca61b76e3..b6693086a556 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -2541,11 +2541,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 ) @@ -2554,9 +2560,9 @@ bool SdrPowerPointImport::GetColorFromPalette( sal_uInt16 nNum, Color& rColor ) } } } - // resgister current color scheme - ((SdrPowerPointImport*)this)->nPageColorsNum = nAktPageNum; - ((SdrPowerPointImport*)this)->ePageColorsKind = eAktPageKind; + // register current color scheme + const_cast<SdrPowerPointImport*>(this)->nPageColorsNum = nAktPageNum; + const_cast<SdrPowerPointImport*>(this)->ePageColorsKind = eAktPageKind; } rColor = aPageColors.GetColor( nNum ); return true; @@ -2778,11 +2784,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 ) { |