[Libreoffice-commits] core.git: sal/rtl
Caolán McNamara
caolanm at redhat.com
Wed Oct 25 19:34:40 UTC 2017
sal/rtl/math.cxx | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
New commits:
commit d754330e05ba2d81fb263f569bddf3e537b8054c
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 25 10:22:00 2017 +0100
ofz#3789 Integer-overflow
with input 69e9223372036854775807
Change-Id: Iaf5a85170d144be2db5604340d784a8982754e08
Reviewed-on: https://gerrit.libreoffice.org/43815
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/sal/rtl/math.cxx b/sal/rtl/math.cxx
index a9404871c228..997280784351 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -19,6 +19,7 @@
#include <rtl/math.h>
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
#include <rtl/alloc.h>
#include <rtl/character.hxx>
@@ -938,7 +939,9 @@ inline double stringToDouble(CharT const * pBegin, CharT const * pEnd,
if ( bExpSign )
nExp = -nExp;
- long nAllExp = ( bOverflow ? 0 : nExp + nValExp );
+ long nAllExp(0);
+ if (!bOverflow)
+ bOverflow = o3tl::checked_add(nExp, nValExp, nAllExp);
if ( nAllExp > DBL_MAX_10_EXP || (bOverflow && !bExpSign) )
{ // overflow
fVal = HUGE_VAL;
More information about the Libreoffice-commits
mailing list