filter/source/msfilter/svdfppt.cxx | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-)
New commits: commit ee6165a184b9ac7f004f2086adb669b5a31575cf Author: Caolán McNamara <caol...@redhat.com> Date: Tue Jan 9 16:27:15 2018 +0000 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 <mst...@redhat.com> Tested-by: Jenkins <c...@libreoffice.org> diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 43449eb59337..eb083340d6a0 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -3327,22 +3327,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 @@ -3421,8 +3416,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 ) {
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits