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

Caolán McNamara caolanm at redhat.com
Mon Dec 11 15:09:30 UTC 2017


 include/oox/drawingml/drawingmltypes.hxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 3e38f8c507d9924fac00b6b7dffc6dafb98bb368
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 11 09:49:21 2017 +0000

    ofz#4591 Integer-overflow
    
    Change-Id: I97d527272f198a46485b98a8f26acd8daa42cab7
    Reviewed-on: https://gerrit.libreoffice.org/46217
    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/include/oox/drawingml/drawingmltypes.hxx b/include/oox/drawingml/drawingmltypes.hxx
index 751f7865c374..689317505249 100644
--- a/include/oox/drawingml/drawingmltypes.hxx
+++ b/include/oox/drawingml/drawingmltypes.hxx
@@ -29,6 +29,7 @@
 #include <com/sun/star/style/ParagraphAdjust.hpp>
 #include <com/sun/star/style/TabAlign.hpp>
 #include <com/sun/star/uno/Reference.hxx>
+#include <o3tl/safeint.hxx>
 #include <oox/dllapi.h>
 #include <oox/helper/helper.hxx>
 #include <rtl/ustring.hxx>
@@ -180,7 +181,7 @@ inline sal_Int64 convertHmmToEmu( sal_Int32 nValue )
 inline sal_Int32 convertEmuToHmm( sal_Int64 nValue )
 {
     sal_Int32 nCorrection = (nValue > 0 ? 1 : -1) * EMU_PER_HMM / 2; // So that the implicit floor will round.
-    return getLimitedValue< sal_Int32, sal_Int64 >( (nValue + nCorrection) / EMU_PER_HMM, SAL_MIN_INT32, SAL_MAX_INT32 );
+    return getLimitedValue<sal_Int32, sal_Int64>(o3tl::saturating_add<sal_Int64>(nValue, nCorrection) / EMU_PER_HMM, SAL_MIN_INT32, SAL_MAX_INT32);
 }
 
 /** Converts the passed 64-bit integer value from EMUs to Points. */


More information about the Libreoffice-commits mailing list