[Libreoffice-commits] core.git: 3 commits - include/tools sfx2/source sw/source

Stephan Bergmann sbergman at redhat.com
Thu Jun 19 00:29:27 PDT 2014


 include/tools/ref.hxx             |    8 ++++++--
 sfx2/source/doc/sfxbasemodel.cxx  |    5 ++++-
 sw/source/core/docnode/ndsect.cxx |    5 ++++-
 3 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit 160ae9889e4d16217a7cca7d930f776f5a645ec8
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jun 19 09:28:47 2014 +0200

    Catch illegal null pointer dereferences early
    
    Change-Id: I4d558e9a6e2c4e4d9feb45eb5a3fd01ee322bef8

diff --git a/include/tools/ref.hxx b/include/tools/ref.hxx
index 0bf519e..87aed32 100644
--- a/include/tools/ref.hxx
+++ b/include/tools/ref.hxx
@@ -19,6 +19,10 @@
 #ifndef INCLUDED_TOOLS_REF_HXX
 #define INCLUDED_TOOLS_REF_HXX
 
+#include <sal/config.h>
+
+#include <cassert>
+
 #include <tools/toolsdllapi.h>
 #include <vector>
 
@@ -59,9 +63,9 @@ public:
 
     T * operator &() const { return pObj; }
 
-    T * operator ->() const { return pObj; }
+    T * operator ->() const { assert(pObj != 0); return pObj; }
 
-    T & operator *() const { return *pObj; }
+    T & operator *() const { assert(pObj != 0); return *pObj; }
 
     operator T *() const { return pObj; }
 
commit e7c1e48794df85d5cb35d67a1bab7543690f084e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jun 19 09:25:28 2014 +0200

    Prevent null pointer dereference
    
    (even though the null pointer dereference in SwSection::GetBaseLink would be
    somewhat harmless in this case, as the result is here immediately turned into a
    pointer again; but it also does not look like LinkManager::Remove is designed to
    be called with a null pointer argument)
    
    Change-Id: Ia1560b03be6a654c1207c146c873f29788b68558

diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 94c3f2e..b004366 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -1363,8 +1363,11 @@ void SwSectionNode::NodesArrChgd()
         }
         else
         {
-            if (CONTENT_SECTION != m_pSection->GetType())
+            if (CONTENT_SECTION != m_pSection->GetType()
+                && m_pSection->IsConnected())
+            {
                 pDoc->GetLinkManager().Remove( &m_pSection->GetBaseLink() );
+            }
 
             if (m_pSection->IsServer())
                 pDoc->GetLinkManager().RemoveServer( m_pSection->GetObject() );
commit 80f8bf77e5420c550294048b31911fefffa12fc5
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jun 19 09:24:35 2014 +0200

    Prevent null pointer dereference
    
    Change-Id: Ia197152f6ece37dd2dd2ce1b41c1dfd1a985781c

diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 35af9e2..15a76db 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -778,7 +778,10 @@ void SAL_CALL SfxBaseModel::dispose() throw(RuntimeException, std::exception)
 
     m_pData->m_xDocumentMetadata.clear();
 
-    EndListening( *m_pData->m_pObjectShell );
+    if ( m_pData->m_pObjectShell.Is() )
+    {
+        EndListening( *m_pData->m_pObjectShell );
+    }
 
     m_pData->m_xCurrent = Reference< frame::XController > ();
     m_pData->m_seqControllers = Sequence< Reference< frame::XController > > () ;


More information about the Libreoffice-commits mailing list