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

Caolán McNamara caolanm at redhat.com
Sun Dec 10 20:06:48 UTC 2017


 oox/source/drawingml/drawingmltypes.cxx |    4 +++-
 svx/source/table/tablemodel.cxx         |    3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit e068d96feceff19977454da6ad3390ad7f7ce507
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Dec 10 15:44:28 2017 +0000

    ofz#4581 Integer-overflow
    
    Change-Id: I7c4e19981c8ef6016f44680657d872102f00f6d3
    Reviewed-on: https://gerrit.libreoffice.org/46190
    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/svx/source/table/tablemodel.cxx b/svx/source/table/tablemodel.cxx
index 2f8c94dc4636..bbe6c42edebd 100644
--- a/svx/source/table/tablemodel.cxx
+++ b/svx/source/table/tablemodel.cxx
@@ -36,6 +36,7 @@
 #include "tablecolumn.hxx"
 #include "tablecolumns.hxx"
 #include "tableundo.hxx"
+#include <o3tl/safeint.hxx>
 #include <svx/svdotable.hxx>
 #include <svx/svdmodel.hxx>
 #include <svx/strings.hrc>
@@ -1004,7 +1005,7 @@ void TableModel::optimize()
                     Reference< XPropertySet > xSet2( static_cast< XCellRange* >( maColumns[nCol-1].get() ), UNO_QUERY_THROW );
                     xSet1->getPropertyValue( sWidth ) >>= nWidth1;
                     xSet2->getPropertyValue( sWidth ) >>= nWidth2;
-                    nWidth1 += nWidth2;
+                    nWidth1 = o3tl::saturating_add(nWidth1, nWidth2);
                     xSet2->setPropertyValue( sWidth, Any( nWidth1 ) );
                 }
                 catch( Exception& )
commit 31dcf60fc8e6bd2f49728e157319af3204f7f1a1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Dec 10 11:35:34 2017 +0000

    ofz#4576 Integer-overflow
    
    Change-Id: I8042170ca2c3e66887374a94aa7d335e4445be69
    Reviewed-on: https://gerrit.libreoffice.org/46182
    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/drawingml/drawingmltypes.cxx b/oox/source/drawingml/drawingmltypes.cxx
index e8ea37dc9cab..cda9c1c61817 100644
--- a/oox/source/drawingml/drawingmltypes.cxx
+++ b/oox/source/drawingml/drawingmltypes.cxx
@@ -23,6 +23,7 @@
 #include <com/sun/star/drawing/Hatch.hpp>
 #include <com/sun/star/style/CaseMap.hpp>
 #include <com/sun/star/xml/sax/XFastAttributeList.hpp>
+#include <o3tl/safeint.hxx>
 #include <osl/diagnose.h>
 #include <sax/tools/converter.hxx>
 #include <oox/token/tokens.hxx>
@@ -40,7 +41,8 @@ namespace drawingml {
 /** converts EMUs into 1/100th mmm */
 sal_Int32 GetCoordinate( sal_Int32 nValue )
 {
-    return (nValue + 180) / 360;
+    nValue = o3tl::saturating_add<sal_Int32>(nValue, 180);
+    return nValue / 360;
 }
 
 /** converts an emu string into 1/100th mmm */


More information about the Libreoffice-commits mailing list