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

Caolán McNamara caolanm at redhat.com
Thu May 31 20:03:41 UTC 2018


 oox/source/vml/vmlshape.cxx |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 7488943c329516c35504fe86c36251c83b24cf74
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 31 17:22:36 2018 +0100

    ofz#8651 Integer-overflow
    
    Change-Id: I0498303d846cd6a2756b91be3d90ec0bf9926a34
    Reviewed-on: https://gerrit.libreoffice.org/55142
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 6b496b50e3a0..d304e63ca1d3 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -22,6 +22,7 @@
 
 #include <boost/optional.hpp>
 
+#include <o3tl/safeint.hxx>
 #include <oox/vml/vmlshape.hxx>
 #include <vcl/wmf.hxx>
 #include <vcl/virdev.hxx>
@@ -201,8 +202,14 @@ awt::Rectangle ShapeType::getAbsRectangle() const
     if ( nHeight == 0 )
         nHeight = 1;
 
-    sal_Int32 nLeft = ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maLeft, 0, true, true )
-        + ConversionHelper::decodeMeasureToHmm( rGraphicHelper, maTypeModel.maMarginLeft, 0, true, true );
+    sal_Int32 nLeft;
+    if (o3tl::checked_add<sal_Int32>(ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maLeft, 0, true, true),
+                                     ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maTypeModel.maMarginLeft, 0, true, true),
+                                     nLeft))
+    {
+        SAL_WARN("oox", "overflow in addition");
+        nLeft = 0;
+    }
     if (nLeft == 0 && maTypeModel.maPosition == "absolute")
         nLeft = 1;
 


More information about the Libreoffice-commits mailing list