[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - writerfilter/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 9 15:03:23 UTC 2020


 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 9eda23ddcd9767c89364016a92eaab4a823df39a
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Dec 9 09:57:11 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Dec 9 16:02:46 2020 +0100

    negative return passed to parameter that cannot be negative
    
    I wonder if the test != 0 is what was really intended here, but
    keep that legacy logic anyway
    
    Change-Id: I4b39a2130e961c6f2ca97695e4625df5a95e00b8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107478
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 9ec336f263eb..86dcf63416fc 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -79,6 +79,7 @@
 #include <com/sun/star/document/XFilter.hpp>
 #include <editeng/flditem.hxx>
 #include <editeng/unotext.hxx>
+#include <o3tl/safeint.hxx>
 #include <o3tl/temporary.hxx>
 #include <oox/mathml/import.hxx>
 #include <xmloff/odffields.hxx>
@@ -157,7 +158,7 @@ static void lcl_handleDropdownField( const uno::Reference< beans::XPropertySet >
         rxFieldProps->setPropertyValue( "Items", uno::makeAny( sItems ) );
 
     sal_Int32 nResult = pFFDataHandler->getDropDownResult().toInt32();
-    if ( nResult )
+    if (nResult > 0 && o3tl::make_unsigned(nResult) < sItems.size())
         rxFieldProps->setPropertyValue( "SelectedItem", uno::makeAny( sItems[ nResult ] ) );
     if ( !pFFDataHandler->getHelpText().isEmpty() )
          rxFieldProps->setPropertyValue( "Help", uno::makeAny( pFFDataHandler->getHelpText() ) );


More information about the Libreoffice-commits mailing list