[Libreoffice-commits] core.git: sal/rtl
Caolán McNamara
caolanm at redhat.com
Thu Jan 4 14:31:33 UTC 2018
sal/rtl/math.cxx | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
New commits:
commit f042128907598e5f82e759a175b564a68edfb490
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jan 3 16:25:19 2018 +0000
ofz#4886 Integer-overflow
sal/rtl/math.cxx:1106:29: runtime error: signed integer overflow: 15 - -2147483648 cannot be represented in type 'int'
Change-Id: Ia81eca9da1fe7cc1a5c5319742b32bd742fb817e
Reviewed-on: https://gerrit.libreoffice.org/47329
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 96c5843dcfea..a450f7baa774 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -1103,12 +1103,14 @@ double SAL_CALL rtl_math_round(double fValue, int nDecPlaces,
else
nExp = 0;
- int nIndex = 15 - nExp;
+ int nIndex;
- if ( nIndex > 15 )
+ if (nExp < 0)
nIndex = 15;
- else if ( nIndex <= 1 )
+ else if (nExp >= 14)
nIndex = 0;
+ else
+ nIndex = 15 - nExp;
fValue = floor(fValue + 0.5 + nKorrVal[nIndex]);
}
More information about the Libreoffice-commits
mailing list