sw/source/filter/html/htmlatr.cxx | 6 +++++- tools/source/memtools/multisel.cxx | 13 +++---------- 2 files changed, 8 insertions(+), 11 deletions(-)
New commits: commit d4155f449726375b1499af49e610c61d4776914b Author: Julien Nabet <[email protected]> AuthorDate: Sat Oct 26 10:57:03 2024 +0200 Commit: Julien Nabet <[email protected]> CommitDate: Sun Oct 27 09:14:07 2024 +0100 tdf#163486: PVS: disable FP Array overrun is possible Change-Id: I68c3c741ed9e0141e4a9a8359a2436dcc53ed292 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175674 Reviewed-by: Julien Nabet <[email protected]> Tested-by: Jenkins diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index 21fbc71a836f..38bee88aaa93 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -694,7 +694,11 @@ static void OutHTML_SwFormat( SwHTMLWriter& rWrt, const SwFormat& rFormat, if( bNumbered ) { - if( !rWrt.m_aBulletGrfs[nBulletGrfLvl].isEmpty() ) + // disable PVS False positive 557 "Array underrun is possible" + // we know here that nBulletGrfLvl < 10 + // we're in the case bInNumberBulletList && bNumbered + // so we retrieved nLvl which comes from SwHTMLNumRuleInfo::GetLevel() + if( !rWrt.m_aBulletGrfs[nBulletGrfLvl].isEmpty() ) //-V557 bNumbered = false; else nBulletGrfLvl = 255; commit ed425db15b24b7f18ea3b5ffcd0c631f0bc7e2f7 Author: Julien Nabet <[email protected]> AuthorDate: Sat Oct 26 10:46:21 2024 +0200 Commit: Julien Nabet <[email protected]> CommitDate: Sun Oct 27 09:13:52 2024 +0100 tdf#163486: PVS: Array overrun is possible In both cases, we know nSubSelPos < aSels.size() since it's been tested some lines before Change-Id: I1e1e7c63f30bf0ea830f050284b5d2af18a597f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175673 Reviewed-by: Noel Grandin <[email protected]> Tested-by: Jenkins Reviewed-by: Julien Nabet <[email protected]> diff --git a/tools/source/memtools/multisel.cxx b/tools/source/memtools/multisel.cxx index 739d2874875a..37e12ff9ac5d 100644 --- a/tools/source/memtools/multisel.cxx +++ b/tools/source/memtools/multisel.cxx @@ -217,11 +217,8 @@ bool MultiSelection::Select( sal_Int32 nIndex, bool bSelect ) else { // split the sub selection - if ( nSubSelPos < aSels.size() ) { - aSels.insert( aSels.begin() + nSubSelPos, Range( aSels[ nSubSelPos ].Min(), nIndex-1 ) ); - } else { - aSels.push_back( Range( aSels[ nSubSelPos ].Min(), nIndex-1 ) ); - } + // we know nSubSelPos < aSels.size() since it's been tested some lines before + aSels.insert( aSels.begin() + nSubSelPos, Range( aSels[ nSubSelPos ].Min(), nIndex-1 ) ); aSels[ nSubSelPos+1 ].Min() = nIndex + 1; } } @@ -323,11 +320,7 @@ void MultiSelection::Insert( sal_Int32 nIndex, sal_Int32 nCount ) if ( aSels[ nSubSelPos ].Min() != nIndex && aSels[ nSubSelPos ].Contains(nIndex) ) { // split the sub selection - if ( nSubSelPos < aSels.size() ) { - aSels.insert( aSels.begin() + nSubSelPos, Range( aSels[ nSubSelPos ].Min(), nIndex-1 ) ); - } else { - aSels.push_back( Range( aSels[ nSubSelPos ].Min(), nIndex-1 ) ); - } + aSels.insert( aSels.begin() + nSubSelPos, Range( aSels[ nSubSelPos ].Min(), nIndex-1 ) ); ++nSubSelPos; aSels[ nSubSelPos ].Min() = nIndex; }
