sal/rtl/math.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
New commits: commit f042128907598e5f82e759a175b564a68edfb490 Author: Caolán McNamara <caol...@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 <c...@libreoffice.org> Reviewed-by: Stephan Bergmann <sberg...@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]); }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits