[Libreoffice-commits] core.git: xmloff/source

Caolán McNamara caolanm at redhat.com
Sun Oct 29 23:16:02 UTC 2017


 xmloff/source/style/shadwhdl.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit d30522e46ca884e9bc74af21711d9537e8118859
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Oct 29 14:44:47 2017 +0000

    ofz#3895 Integer-overflow
    
    Change-Id: Ibc90bdad5edf2d382e358dde4a0bfce6e4276584
    Reviewed-on: https://gerrit.libreoffice.org/44026
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/xmloff/source/style/shadwhdl.cxx b/xmloff/source/style/shadwhdl.cxx
index 139e60835b90..20d12f7571f4 100644
--- a/xmloff/source/style/shadwhdl.cxx
+++ b/xmloff/source/style/shadwhdl.cxx
@@ -23,6 +23,7 @@
 
 
 #include <com/sun/star/table/ShadowFormat.hpp>
+#include <o3tl/safeint.hxx>
 #include <tools/color.hxx>
 #include <sax/tools/converter.hxx>
 #include <xmloff/xmluconv.hxx>
@@ -98,8 +99,10 @@ bool XMLShadowPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue
                 if( nX < 0 ) nX *= -1;
                 if( nY < 0 ) nY *= -1;
 
-                aShadow.ShadowWidth = sal::static_int_cast< sal_Int16 >(
-                    (nX + nY) >> 1);
+                sal_Int32 nWidth;
+                bRet = !o3tl::checked_add(nX, nY, nWidth);
+                if (bRet)
+                    aShadow.ShadowWidth = sal::static_int_cast<sal_Int16>(nWidth >> 1);
             }
         }
     }


More information about the Libreoffice-commits mailing list