summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-12-11 09:49:21 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-12-11 16:06:49 +0100
commit3e38f8c507d9924fac00b6b7dffc6dafb98bb368 (patch)
tree22ca9f52cfa4a8360e5aed14c7d6b51504451145 /include
parent8d62b79f168180c6992eb483ec864d473050635f (diff)
ofz#4591 Integer-overflow
Change-Id: I97d527272f198a46485b98a8f26acd8daa42cab7 Reviewed-on: https://gerrit.libreoffice.org/46217 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/oox/drawingml/drawingmltypes.hxx3
1 files changed, 2 insertions, 1 deletions
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. */