summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-01-09 16:27:15 +0000
committerMichael Stahl <Michael.Stahl@cib.de>2019-08-01 15:57:19 +0200
commitc1f6895b477a43fe9943dd4d0667d4cf2f843ea9 (patch)
tree7d81bd90bea35ffc829a0e6253b8ee88920d20ab /filter
parentda08c73dad09c49429dba515d914da4e457a1083 (diff)
ofz#5154 limit depth to max legal depth
i <= 5 was nonsense here Change-Id: Ic1b0daf874b9df13ad012d11efaee1c31a47b1d6 Reviewed-on: https://gerrit.libreoffice.org/47667 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit ee6165a184b9ac7f004f2086adb669b5a31575cf)
Diffstat (limited to 'filter')
-rw-r--r--filter/source/msfilter/svdfppt.cxx26
1 files changed, 11 insertions, 15 deletions
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index f2cf6b7c9e66..cc37aa11cd34 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -3307,22 +3307,17 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const
if ( aHd.nRecInstance < PPT_STYLESHEETENTRYS )
{
sal_uInt16 nDepth = 0, i = 0;
- rSt.ReadUInt16( nDepth );
- if ( i <= 5 )
+ rSt.ReadUInt16(nDepth);
+ nDepth = std::min<sal_uInt16>(nDepth, nMaxPPTLevels);
+ auto nHdEndRecPos = DffPropSet::SanitizeEndPos(rSt, aHd.GetRecEndFilePos());
+ while ( ( rSt.GetError() == 0 ) && ( rSt.Tell() < nHdEndRecPos ) && ( i < nDepth ) )
{
- auto nHdEndRecPos = DffPropSet::SanitizeEndPos(rSt, aHd.GetRecEndFilePos());
- while ( ( rSt.GetError() == 0 ) && ( rSt.Tell() < nHdEndRecPos ) && ( i < nDepth ) )
- {
- bStyles = true;
- ReadPPTExtParaLevel( rSt, aExtParaSheet[ (TSS_Type)aHd.nRecInstance ].aExtParaLevel[ i++ ] );
- }
-#ifdef DBG_UTIL
- if ( rSt.Tell() != aHd.GetRecEndFilePos() )
- OSL_FAIL( "PPTExParaProv::PPTExParaProv - error reading PPT_PST_ExtendedParagraphMasterAtom (SJ)" );
-#endif
+ bStyles = true;
+ ReadPPTExtParaLevel( rSt, aExtParaSheet[ (TSS_Type)aHd.nRecInstance ].aExtParaLevel[ i++ ] );
}
#ifdef DBG_UTIL
- else OSL_FAIL( "PPTExParaProv::PPTExParaProv - depth is greater than 5 (SJ)" );
+ if ( rSt.Tell() != aHd.GetRecEndFilePos() )
+ OSL_FAIL( "PPTExParaProv::PPTExParaProv - error reading PPT_PST_ExtendedParagraphMasterAtom (SJ)" );
#endif
}
#ifdef DBG_UTIL
@@ -3402,8 +3397,9 @@ bool PPTNumberFormatCreator::ImplGetExtNumberFormat( SdrPowerPointImport& rManag
}
if ( ( nBuFlags & 0x03800000 ) != 0x03800000 ) // merge style sheet
- { // we have to read the master attributes
- if ( pParaProv && ( nLevel < 5 ) )
+ {
+ // we have to read the master attributes
+ if (pParaProv && nLevel < nMaxPPTLevels)
{
if ( pParaProv->bStyles )
{