diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-07-16 11:26:37 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-07-16 15:19:32 +0200 |
commit | 15eac2ba222d2d07dfa2bb962f4bbddbcecb9dbc (patch) | |
tree | 61e3014a022bdd03c19d4b01385342d777f8bb87 /sc | |
parent | 2ad6beb1dff9a2e4e864831fdfc2c9c058506944 (diff) |
ofz#49017 Integer-overflow
Change-Id: Iadb8c0a9bccef400f1c7fb6e5f2f3444a45da480
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137119
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/tool/token.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 1db10bc21de3..22359d060b0a 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -5347,9 +5347,9 @@ sal_Int32 ScTokenArray::GetWeight() const const auto pComplexRef = (*pRPN[i]).GetDoubleRef(); // Number of cells referenced divided by 10. - const double nNumCellsTerm = - (1 + (pComplexRef->Ref2.Row() - pComplexRef->Ref1.Row())) * - (1 + (pComplexRef->Ref2.Col() - pComplexRef->Ref1.Col())) / 10.; + const double nRows = 1 + (pComplexRef->Ref2.Row() - pComplexRef->Ref1.Row()); + const double nCols = 1 + (pComplexRef->Ref2.Col() - pComplexRef->Ref1.Col()); + const double nNumCellsTerm = nRows * nCols / 10.0; if (nNumCellsTerm + nResult < SAL_MAX_INT32) nResult += nNumCellsTerm; |