[Libreoffice-commits] core.git: 2 commits - basic/source sc/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Nov 11 13:35:42 UTC 2019


 basic/source/classes/sbxmod.cxx |   18 ++++++++++--------
 sc/source/core/tool/address.cxx |    3 ++-
 2 files changed, 12 insertions(+), 9 deletions(-)

New commits:
commit 6755977f590ffcef629f8ccee7675a8368a2ea83
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Nov 11 10:52:37 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Nov 11 14:34:51 2019 +0100

    cid#1455213 Dereference after null check
    
    Change-Id: I2f59ed3c94d3a27fe50ca99f511f9ba5b47ff5d1
    Reviewed-on: https://gerrit.libreoffice.org/82426
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index b4cb3af77e0f..b210e7bedc03 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -1332,7 +1332,8 @@ static ScRefFlags lcl_ScAddress_Parse_OOo( const sal_Unicode* p, const ScDocumen
                 long n = rtl_ustr_toInt32( p, 10 ) - 1;
                 while (rtl::isAsciiDigit( *p ))
                     p++;
-                if( n < 0 || n > pDoc->MaxRow() )
+                const SCROW nMaxRow = (pDoc ? pDoc->MaxRow() : MAXROW);
+                if( n < 0 || n > nMaxRow )
                     nBits = ScRefFlags::ZERO;
                 nRow = static_cast<SCROW>(n);
             }
commit 2297f042693a3c788d1eb264c170c6f59c439001
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Nov 11 11:10:29 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Nov 11 14:34:37 2019 +0100

    call GetSbData just once
    
    Change-Id: Idb63c169c7e39f27bc99e3c3aa9155583f2a65ab
    Reviewed-on: https://gerrit.libreoffice.org/82431
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 0015aeadc098..bbab27dec8c8 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -1210,26 +1210,28 @@ void SbModule::RunInit()
      && !pImage->bInit
      && pImage->IsFlag( SbiImageFlags::INITCODE ) )
     {
+        SbiGlobals* pSbData = GetSbData();
+
         // Set flag, so that RunInit get active (Testtool)
-        GetSbData()->bRunInit = true;
+        pSbData->bRunInit = true;
 
-        SbModule* pOldMod = GetSbData()->pMod;
-        GetSbData()->pMod = this;
+        SbModule* pOldMod = pSbData->pMod;
+        pSbData->pMod = this;
         // The init code starts always here
         std::unique_ptr<SbiRuntime> pRt(new SbiRuntime( this, nullptr, 0 ));
 
-        pRt->pNext = GetSbData()->pInst->pRun;
-        GetSbData()->pInst->pRun = pRt.get();
+        pRt->pNext = pSbData->pInst->pRun;
+        pSbData->pInst->pRun = pRt.get();
         while( pRt->Step() ) {}
 
-        GetSbData()->pInst->pRun = pRt->pNext;
+        pSbData->pInst->pRun = pRt->pNext;
         pRt.reset();
-        GetSbData()->pMod = pOldMod;
+        pSbData->pMod = pOldMod;
         pImage->bInit = true;
         pImage->bFirstInit = false;
 
         // RunInit is not active anymore
-        GetSbData()->bRunInit = false;
+        pSbData->bRunInit = false;
     }
 }
 


More information about the Libreoffice-commits mailing list