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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Jan 28 12:42:23 UTC 2019


 sw/source/core/unocore/unodraw.cxx |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 348482e41c9391e8fc0bab9b8eee8f52ffabfac2
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Jan 28 09:11:45 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Jan 28 13:42:02 2019 +0100

    ofz#12729 integer-overflow
    
    Change-Id: I78db6ab6fcc677247716f42d3c102314415c34d2
    Reviewed-on: https://gerrit.libreoffice.org/66993
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 1e34acbff52b..2b59d3ef2008 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -58,6 +58,7 @@
 #include <editeng/lrspitem.hxx>
 #include <editeng/ulspitem.hxx>
 #include <o3tl/any.hxx>
+#include <o3tl/safeint.hxx>
 #include <svx/shapepropertynotifier.hxx>
 #include <crstate.hxx>
 #include <comphelper/extract.hxx>
@@ -2308,8 +2309,8 @@ void SAL_CALL SwXShape::setPosition( const awt::Point& aPosition )
             awt::Point aAttrPosInHoriL2R(
                     ConvertPositionToHoriL2R( xGroupShape->getPosition(),
                                                xGroupShape->getSize() ) );
-            aNewPos.X -= aAttrPosInHoriL2R.X;
-            aNewPos.Y -= aAttrPosInHoriL2R.Y;
+            aNewPos.X = o3tl::saturating_sub(aNewPos.X, aAttrPosInHoriL2R.X);
+            aNewPos.Y = o3tl::saturating_sub(aNewPos.Y, aAttrPosInHoriL2R.Y);
         }
         // convert relative position in horizontal left-to-right layout into
         // absolute position in horizontal left-to-right layout
@@ -2323,8 +2324,8 @@ void SAL_CALL SwXShape::setPosition( const awt::Point& aPosition )
             SvxShape* pSvxGroupShape = reinterpret_cast< SvxShape * >(
                     sal::static_int_cast< sal_IntPtr >( xGrpShapeTunnel->getSomething(SvxShape::getUnoTunnelId()) ));
             const awt::Point aGroupPos = pSvxGroupShape->getPosition();
-            aNewPos.X += aGroupPos.X;
-            aNewPos.Y += aGroupPos.Y;
+            aNewPos.X = o3tl::saturating_add(aNewPos.X, aGroupPos.X);
+            aNewPos.Y = o3tl::saturating_add(aNewPos.Y, aGroupPos.Y);
         }
         // set position
         mxShape->setPosition( aNewPos );


More information about the Libreoffice-commits mailing list