basic/source/classes/sbunoobj.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit c387bc7dd1762f807128ecdbf79ec63884aa33b6
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Wed Jun 1 23:35:27 2022 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Thu Jun 2 08:07:08 2022 +0200

    The elements of XInvocation::invoke aOutParamIndex are non-negative
    
    ..so use o3tl::make_unsigned when comparing them against an expression of
    unsigned integer type, instead of casting that expression to a signed type
    
    Change-Id: I4fc0bd4447f55d5fd9bf893a4b22d6d2c2cfe3d7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135280
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/basic/source/classes/sbunoobj.cxx 
b/basic/source/classes/sbunoobj.cxx
index ad4aefb52f72..06b67ba8bd86 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -20,6 +20,7 @@
 #include <sal/config.h>
 
 #include <o3tl/any.hxx>
+#include <o3tl/safeint.hxx>
 #include <utility>
 #include <vcl/svapp.hxx>
 #include <vcl/errcode.hxx>
@@ -1534,7 +1535,7 @@ static Any invokeAutomationMethod( const OUString& Name, 
Sequence< Any > const &
         for( sal_uInt32 j = 0 ; j < nLen ; j++ )
         {
             sal_Int16 iTarget = pIndices[ j ];
-            if( iTarget >= static_cast<sal_Int16>(nParamCount) )
+            if( o3tl::make_unsigned(iTarget) >= nParamCount )
                 break;
             unoToSbxValue(pParams->Get(j + 1), pNewValues[j]);
         }

Reply via email to