From 8013fcadd975d5e72e86afd96de41feaca42a23a Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 22 Dec 2023 21:42:05 +0000 Subject: cid#1471704 Assignment of overlapping memory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit overlapping_assignment: Assigning (*this).nNum[0] to (*this).nVal, which have overlapping memory locations and different types. Change-Id: I70d7236af27bf5399ad5eb5553befd2eb33e37db Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161202 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- tools/source/generic/bigint.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tools') diff --git a/tools/source/generic/bigint.cxx b/tools/source/generic/bigint.cxx index 240494dfc15d..80b86af6013c 100644 --- a/tools/source/generic/bigint.cxx +++ b/tools/source/generic/bigint.cxx @@ -76,14 +76,15 @@ void BigInt::Normalize() { constexpr sal_uInt32 maxForPosInt32 = std::numeric_limits::max(); constexpr sal_uInt32 maxForNegInt32 = -sal_Int64(std::numeric_limits::min()); - if (bIsNeg && nNum[0] <= maxForNegInt32) + sal_uInt32 nNum0 = nNum[0]; + if (bIsNeg && nNum0 <= maxForNegInt32) { - nVal = -sal_Int64(nNum[0]); + nVal = -sal_Int64(nNum0); nLen = 0; } - else if (!bIsNeg && nNum[0] <= maxForPosInt32) + else if (!bIsNeg && nNum0 <= maxForPosInt32) { - nVal = nNum[0]; + nVal = nNum0; nLen = 0; } } -- cgit