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

Caolán McNamara caolanm at redhat.com
Wed Oct 25 19:34:19 UTC 2017


 xmloff/source/draw/ximpshap.cxx |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

New commits:
commit 713fb4a8d3a19440013ca423f048ff6431c11d14
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Oct 25 14:36:43 2017 +0100

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

diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index bdc453b969e4..7a77be7d0fa3 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -82,6 +82,7 @@
 #include <basegfx/polygon/b2dpolygontools.hxx>
 #include <basegfx/polygon/b2dpolypolygontools.hxx>
 #include <basegfx/vector/b2dvector.hxx>
+#include <o3tl/safeint.hxx>
 
 #include <config_features.h>
 
@@ -850,19 +851,19 @@ void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const OUString& rL
         {
             GetImport().GetMM100UnitConverter().convertMeasureToCore(
                     maSize.Width, rValue);
-            if( maSize.Width > 0 )
-                maSize.Width += 1;
-            else if( maSize.Width < 0 )
-                maSize.Width -= 1;
+            if (maSize.Width > 0)
+                maSize.Width = o3tl::saturating_add(maSize.Width, 1);
+            else if (maSize.Width < 0)
+                maSize.Width = o3tl::saturating_add(maSize.Width, -1);
         }
         else if( IsXMLToken( rLocalName, XML_HEIGHT ) )
         {
             GetImport().GetMM100UnitConverter().convertMeasureToCore(
                     maSize.Height, rValue);
-            if( maSize.Height > 0 )
-                maSize.Height += 1;
-            else if( maSize.Height < 0 )
-                maSize.Height -= 1;
+            if (maSize.Height > 0)
+                maSize.Height = o3tl::saturating_add(maSize.Height, 1);
+            else if (maSize.Height < 0)
+                maSize.Height = o3tl::saturating_add(maSize.Height, -1);
         }
         else if( IsXMLToken( rLocalName, XML_TRANSFORM ) )
         {


More information about the Libreoffice-commits mailing list