Kaydet (Commit) f0421289 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Stephan Bergmann

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/47329Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 10d64258
......@@ -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]);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment