basic/source/sbx/sbxbase.cxx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
New commits: commit c56b5f9758c942ff5ccaaff5632fbe4ace8c3cbb Author: Caolán McNamara <[email protected]> AuthorDate: Wed Apr 28 19:45:43 2021 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Fri May 7 11:56:11 2021 +0200 cid#1474072 silence Untrusted loop bound Change-Id: I2f966440b59c61bfd692c0e63bdffc37eafdb7a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115229 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx index b57c9bdb9008..b980e0e9e2d7 100644 --- a/basic/source/sbx/sbxbase.cxx +++ b/basic/source/sbx/sbxbase.cxx @@ -178,16 +178,25 @@ SbxObject* SbxBase::CreateObject( const OUString& rClass ) return pNew; } +namespace { + +// coverity[ -taint_source ] +[[nodiscard]] SbxFlagBits CorrectFlags(SbxFlagBits nFlags) +{ + // Correcting a foolishness of mine: + if (nFlags & SbxFlagBits::Reserved) + nFlags |= SbxFlagBits::GlobalSearch; + return nFlags & ~SbxFlagBits::Reserved; +} + +} + SbxBase* SbxBase::Load( SvStream& rStrm ) { sal_uInt16 nSbxId(0), nFlagsTmp(0), nVer(0); sal_uInt32 nCreator(0), nSize(0); rStrm.ReadUInt32( nCreator ).ReadUInt16( nSbxId ).ReadUInt16( nFlagsTmp ).ReadUInt16( nVer ); - SbxFlagBits nFlags = static_cast<SbxFlagBits>(nFlagsTmp); - - // Correcting a foolishness of mine: - if( nFlags & SbxFlagBits::Reserved ) - nFlags = ( nFlags & ~SbxFlagBits::Reserved ) | SbxFlagBits::GlobalSearch; + SbxFlagBits nFlags = CorrectFlags(static_cast<SbxFlagBits>(nFlagsTmp)); sal_uInt64 nOldPos = rStrm.Tell(); rStrm.ReadUInt32( nSize ); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
