diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-03-16 09:53:19 +0000 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-03-21 22:57:40 +0000 |
commit | 8a9d3e26ded4a0971413d9ccb9ca9a321ff164fb (patch) | |
tree | 65546c7ba5adcaf2d940b9e985d077adbca6bbf3 /filter | |
parent | e8a070fd1170a7452d57304d6cf979f0c9961a0e (diff) |
ofz#875 limit depth to max legal depth
Change-Id: Icbe9339148dc4aeb31c160e976385e3bcaef75b6
(cherry picked from commit 30e2b7203963af215c9aaaec12383e0d5e1f6a7f)
Reviewed-on: https://gerrit.libreoffice.org/35260
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/msfilter/svdfppt.cxx | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index a64ff32d6db0..8b95a67dca28 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -5939,6 +5939,14 @@ bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, TSS_Ty bool bIsHardAttribute = ( ( pParaSet->mnAttrSet & nMask ) != 0 ); + sal_uInt16 nDepth = pParaSet->mnDepth; + + if (nDepth >= nMaxPPTLevels) + { + SAL_WARN("filter.ms", "Para Style Sheet depth " << nDepth << " but " << nMaxPPTLevels - 1 << " is max possible"); + nDepth = nMaxPPTLevels - 1; + } + if ( bIsHardAttribute ) { if ( nAttr == PPT_ParaAttr_BulletColor ) @@ -5947,7 +5955,7 @@ bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, TSS_Ty if ( pParaSet->mnAttrSet & ( 1 << PPT_ParaAttr_BuHardColor ) ) bHardBulletColor = pParaSet->mpArry[ PPT_ParaAttr_BuHardColor ] != 0; else - bHardBulletColor = ( mrStyleSheet.mpParaSheet[ mnInstance ]->maParaLevel[ pParaSet->mnDepth ].mnBuFlags + bHardBulletColor = ( mrStyleSheet.mpParaSheet[ mnInstance ]->maParaLevel[nDepth].mnBuFlags & ( 1 << PPT_ParaAttr_BuHardColor ) ) != 0; if ( bHardBulletColor ) rRetValue = pParaSet->mnBulletColor; @@ -5963,7 +5971,7 @@ bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, TSS_Ty } else { - rRetValue = mrStyleSheet.mpCharSheet[ nDestinationInstance ]->maCharLevel[ pParaSet->mnDepth ].mnFontColor; + rRetValue = mrStyleSheet.mpCharSheet[ nDestinationInstance ]->maCharLevel[nDepth].mnFontColor; } } } @@ -5974,7 +5982,7 @@ bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, TSS_Ty if ( pParaSet->mnAttrSet & ( 1 << PPT_ParaAttr_BuHardFont ) ) bHardBuFont = pParaSet->mpArry[ PPT_ParaAttr_BuHardFont ] != 0; else - bHardBuFont = ( mrStyleSheet.mpParaSheet[ mnInstance ]->maParaLevel[ pParaSet->mnDepth ].mnBuFlags + bHardBuFont = ( mrStyleSheet.mpParaSheet[ mnInstance ]->maParaLevel[nDepth].mnBuFlags & ( 1 << PPT_ParaAttr_BuHardFont ) ) != 0; if ( bHardBuFont ) rRetValue = pParaSet->mpArry[ PPT_ParaAttr_BulletFont ]; @@ -5991,7 +5999,7 @@ bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, TSS_Ty } else { - rRetValue = mrStyleSheet.mpCharSheet[ nDestinationInstance ]->maCharLevel[ pParaSet->mnDepth ].mnFont; + rRetValue = mrStyleSheet.mpCharSheet[ nDestinationInstance ]->maCharLevel[nDepth].mnFont; } } } @@ -6001,14 +6009,14 @@ bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, TSS_Ty } else { - const PPTParaLevel& rParaLevel = mrStyleSheet.mpParaSheet[ mnInstance ]->maParaLevel[ pParaSet->mnDepth ]; + const PPTParaLevel& rParaLevel = mrStyleSheet.mpParaSheet[ mnInstance ]->maParaLevel[nDepth]; PPTParaLevel* pParaLevel = nullptr; if ( ( nDestinationInstance == TSS_Type::Unknown ) - || ( pParaSet->mnDepth && ( ( mnInstance == TSS_Type::Subtitle ) || ( mnInstance == TSS_Type::TextInShape ) ) ) ) + || ( nDepth && ( ( mnInstance == TSS_Type::Subtitle ) || ( mnInstance == TSS_Type::TextInShape ) ) ) ) bIsHardAttribute = true; else if ( nDestinationInstance != mnInstance ) - pParaLevel = &mrStyleSheet.mpParaSheet[ nDestinationInstance ]->maParaLevel[ pParaSet->mnDepth ]; + pParaLevel = &mrStyleSheet.mpParaSheet[ nDestinationInstance ]->maParaLevel[nDepth]; switch ( nAttr ) { case PPT_ParaAttr_BulletOn : @@ -6056,7 +6064,7 @@ bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, TSS_Ty } else { - rRetValue = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[ pParaSet->mnDepth ].mnFont; + rRetValue = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[nDepth].mnFont; bIsHardAttribute = true; } } @@ -6092,7 +6100,7 @@ bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, TSS_Ty if( rPortion.mbHardHylinkOrigColor ) rRetValue = rPortion.mnHylinkOrigColor; else - rRetValue = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[ pParaSet->mnDepth ].mnFontColor; + rRetValue = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[nDepth].mnFontColor; bIsHardAttribute = true; } else @@ -6102,7 +6110,7 @@ bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, TSS_Ty } else { - rRetValue = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[ pParaSet->mnDepth ].mnFontColor; + rRetValue = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[nDepth].mnFontColor; bIsHardAttribute = true; } } |