diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-04-28 19:45:43 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-05-07 11:56:11 +0200 |
commit | c56b5f9758c942ff5ccaaff5632fbe4ace8c3cbb (patch) | |
tree | 3126f2d06cbd175ae131ba57e70f471e1c4acd09 /basic/source | |
parent | 37dd4cb99bf44e57cca0272ed6de8c8156f35efa (diff) |
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 <caolanm@redhat.com>
Diffstat (limited to 'basic/source')
-rw-r--r-- | basic/source/sbx/sbxbase.cxx | 19 |
1 files changed, 14 insertions, 5 deletions
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 ); |