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

Caolán McNamara caolanm at redhat.com
Sun Jan 7 20:06:37 UTC 2018


 tools/source/generic/bigint.cxx |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit 44b938040f312def227c9ed72d1f83811cf67f1a
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jan 6 21:01:32 2018 +0000

    ofz#4995 Integer-overflow
    
    Change-Id: Iad6e1c90cb099077809cc5684f683a0ba25b303b
    Reviewed-on: https://gerrit.libreoffice.org/47519
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/tools/source/generic/bigint.cxx b/tools/source/generic/bigint.cxx
index 883e3804617d..e4afdb6be55e 100644
--- a/tools/source/generic/bigint.cxx
+++ b/tools/source/generic/bigint.cxx
@@ -51,17 +51,19 @@ void BigInt::MakeBigInt( const BigInt& rVal )
     }
     else
     {
-        sal_Int32 nTmp = rVal.nVal;
-
-        nVal   = rVal.nVal;
+        nVal = rVal.nVal;
         bIsBig = true;
-        if ( nTmp < 0 )
+        sal_uInt32 nTmp;
+        if (nVal < 0)
         {
             bIsNeg = true;
-            nTmp = -nTmp;
+            nTmp = -static_cast<sal_Int64>(nVal);
         }
         else
+        {
             bIsNeg = false;
+            nTmp = nVal;
+        }
 
         nNum[0] = (sal_uInt16)(nTmp & 0xffffL);
         nNum[1] = (sal_uInt16)(nTmp >> 16);


More information about the Libreoffice-commits mailing list