[Libreoffice-commits] core.git: tools/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Jan 15 07:09:19 UTC 2021


 tools/source/generic/bigint.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 61a3aaae61dfb6d9538eeeed4721d44293d737f4
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Thu Jan 14 14:31:22 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Jan 15 08:08:40 2021 +0100

    cid#1471704 workaround
    
    Coverity complaints that
    "nVal = nNum[0] in bigint.cxx:84 is an assignment of overlapping memory"
    But this is essentially a tagged union, so it's actually fine.
    Workaround the warning by using a temporary (which the compiler
    will optimise away anyhow)
    
    Change-Id: I0fda945f831b1cdd7b33f7cb671a744150990bf6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109294
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/tools/source/generic/bigint.cxx b/tools/source/generic/bigint.cxx
index 5c8c7771a2c5..f6627200a61c 100644
--- a/tools/source/generic/bigint.cxx
+++ b/tools/source/generic/bigint.cxx
@@ -80,14 +80,16 @@ void BigInt::Normalize()
 
         if ( nLen < 3 )
         {
+            sal_Int32 newVal;
             if ( nLen < 2 )
-                nVal = nNum[0];
+                newVal = nNum[0];
             else if ( nNum[1] & 0x8000 )
                 return;
             else
-                nVal = (static_cast<sal_Int32>(nNum[1]) << 16) + nNum[0];
+                newVal = (static_cast<sal_Int32>(nNum[1]) << 16) + nNum[0];
 
             nLen = 0;
+            nVal = newVal;
 
             if ( bIsNeg )
                 nVal = -nVal;


More information about the Libreoffice-commits mailing list