[Libreoffice-commits] core.git: 13 commits - filter/source include/sfx2 sc/qa sc/source sfx2/source starmath/source svtools/source sw/inc sw/source ucbhelper/source

Caolán McNamara caolanm at redhat.com
Sun Mar 9 14:20:38 PDT 2014


 filter/source/msfilter/msdffimp.cxx    |   19 ++++++++++++++-----
 include/sfx2/tbxctrl.hxx               |    1 -
 sc/qa/unit/subsequent_filters-test.cxx |    1 +
 sc/source/core/data/column.cxx         |    1 +
 sfx2/source/doc/doctempl.cxx           |    2 +-
 starmath/source/edit.cxx               |    6 +++---
 svtools/source/control/hyperlabel.cxx  |    4 ++++
 sw/inc/crstate.hxx                     |    2 ++
 sw/source/core/text/porlin.cxx         |    1 +
 sw/source/core/undo/unsort.cxx         |    7 +++++--
 sw/source/core/undo/untbl.cxx          |   13 ++++++++++---
 ucbhelper/source/client/content.cxx    |   26 +++++++++++++++-----------
 12 files changed, 57 insertions(+), 26 deletions(-)

New commits:
commit ec4498a39323c99295b9864c72ecab0c21daf159
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 9 21:10:17 2014 +0000

    coverity#1078944 Uncaught exception
    
    a false positive but easier to fix it by helping coverity out
    for any other cases it triggers
    
    Change-Id: I7c61298a95fa427d279599110b7aab263d039c5d

diff --git a/ucbhelper/source/client/content.cxx b/ucbhelper/source/client/content.cxx
index f4b9beb..0dcd2ab 100644
--- a/ucbhelper/source/client/content.cxx
+++ b/ucbhelper/source/client/content.cxx
@@ -226,19 +226,15 @@ static void ensureContentProviderForURL( const Reference< XUniversalContentBroke
 }
 
 
-static Reference< XContentIdentifier > getContentIdentifier(
+static Reference< XContentIdentifier > getContentIdentifierThrow(
                                     const Reference< XUniversalContentBroker > & rBroker,
-                                    const OUString & rURL,
-                                    bool bThrow )
-    throw ( ContentCreationException, RuntimeException )
+                                    const OUString & rURL)
+    throw (ContentCreationException, RuntimeException)
 {
     Reference< XContentIdentifier > xId
         = rBroker->createContentIdentifier( rURL );
 
-    if ( xId.is() )
-        return xId;
-
-    if ( bThrow )
+    if (!xId.is())
     {
         ensureContentProviderForURL( rBroker, rURL );
 
@@ -248,7 +244,15 @@ static Reference< XContentIdentifier > getContentIdentifier(
             ContentCreationError_IDENTIFIER_CREATION_FAILED );
     }
 
-    return Reference< XContentIdentifier >();
+    return xId;
+}
+
+static Reference< XContentIdentifier > getContentIdentifierNoThrow(
+                                    const Reference< XUniversalContentBroker > & rBroker,
+                                    const OUString & rURL)
+    throw (RuntimeException)
+{
+    return rBroker->createContentIdentifier(rURL);
 }
 
 
@@ -309,7 +313,7 @@ Content::Content( const OUString& rURL,
         UniversalContentBroker::create( rCtx ) );
 
     Reference< XContentIdentifier > xId
-        = getContentIdentifier( pBroker, rURL, true );
+        = getContentIdentifierThrow(pBroker, rURL);
 
     Reference< XContent > xContent = getContent( pBroker, xId, true );
 
@@ -342,7 +346,7 @@ bool Content::create( const OUString& rURL,
         UniversalContentBroker::create( rCtx ) );
 
     Reference< XContentIdentifier > xId
-        = getContentIdentifier( pBroker, rURL, false );
+        = getContentIdentifierNoThrow(pBroker, rURL);
     if ( !xId.is() )
         return false;
 
commit 5bd3a42baf1fe3bed945d5f630c800ce7300a763
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 9 21:00:11 2014 +0000

    coverity#1078822 Dereference before null check
    
    Change-Id: I6cc2ed1777a797c74b4a6d9618af6a62ad5ff247

diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index 3fd9ede..b8cb874 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -422,6 +422,8 @@ void SmEditWindow::KeyInput(const KeyEvent& rKEvt)
         StartCursorMove();
 
         bool autoClose = false;
+        if (!pEditView)
+            CreateEditView();
         ESelection aSelection = pEditView->GetSelection();
         // as we don't support RTL in Math, we need to swap values from selection when they were done
         // in RTL form
@@ -459,8 +461,6 @@ void SmEditWindow::KeyInput(const KeyEvent& rKEvt)
                 autoClose = true;
         }
 
-        if (!pEditView)
-            CreateEditView();
         if ( !pEditView->PostKeyEvent(rKEvt) )
         {
             SmViewShell *pView = GetView();
commit a831e56c2402f1785350438300e516e4a830c0ba
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 9 20:58:39 2014 +0000

    we can move the pEditView delete inside the previous check for pEditView
    
    Change-Id: I612a4f8ee1e49b1468a2898678660bd66902fc96

diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index ecabca2..3fd9ede 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -142,8 +142,8 @@ SmEditWindow::~SmEditWindow()
             pEditEngine->SetStatusEventHdl( Link() );
             pEditEngine->RemoveView( pEditView );
         }
+        delete pEditView;
     }
-    delete pEditView;
     delete pHScrollBar;
     delete pVScrollBar;
     delete pScrollBox;
commit e03c29f50aa057544b3b6d0b0161dd433086b228
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 9 20:55:49 2014 +0000

    coverity#1078732 Dereference null return value
    
    Change-Id: I6008d2ef94979a7b2224ca217a158cbcbb1fd716

diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx
index 35cb048..2ad4321 100644
--- a/sfx2/source/doc/doctempl.cxx
+++ b/sfx2/source/doc/doctempl.cxx
@@ -1212,7 +1212,7 @@ sal_Bool SfxDocumentTemplates::GetLogicNames
             for ( sal_uIntPtr j=0; !bFound && (j<nChildCount); j++ )
             {
                 pEntry = pData->GetEntry( j );
-                if ( pEntry->GetTargetURL() == aPath )
+                if ( pEntry && pEntry->GetTargetURL() == aPath )
                 {
                     bFound = sal_True;
                 }
commit 5707a371d5ab36fa4794d82242512809923c2a13
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 9 20:54:03 2014 +0000

    coverity#1078724 Dereference null return value
    
    Change-Id: I846de53d308d5e232b65ddc573e4e22a0ee97c38

diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 21ad019..5336a58 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -1149,6 +1149,7 @@ void checkCellValidity( const ScAddress& rValBaseAddr, const ScRange& rRange, co
     //get from the document the data validation entry we are checking against
     const SfxUInt32Item* pItem = static_cast<const SfxUInt32Item*>(pDoc->GetAttr(nBCol, nBRow, nTab, ATTR_VALIDDATA) );
     const ScValidationData* pValData = pDoc->GetValidationEntry( pItem->GetValue() );
+    CPPUNIT_ASSERT(pValData);
 
     //check that each cell in the expected range is associated with the data validation entry
     for(SCCOL i = rRange.aStart.Col(); i <= rRange.aEnd.Col(); ++i)
commit f1529383d4ce70fb23d0cb6e31b54e5a9da76b9b
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 9 20:43:00 2014 +0000

    coverity#705649 Resource leak
    
    Change-Id: I4899851af28b20a20c7b07301c22ddacdbb89b27

diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index cdc30bc..ccf0dff 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4887,7 +4887,9 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
     {
         SvxMSDffImportData& rImportData = *(SvxMSDffImportData*)pData;
         SvxMSDffImportRec* pImpRec = new SvxMSDffImportRec;
+        bool bDeleteImpRec = true;
         SvxMSDffImportRec* pTextImpRec = pImpRec;
+        bool bDeleteTextImpRec = false;
 
         // fill Import Record with data
         pImpRec->nShapeId   = rObjData.nShapeId;
@@ -5083,6 +5085,7 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
 
             pTextObj = new SdrRectObj(OBJ_TEXT, rTextRect);
             pTextImpRec = new SvxMSDffImportRec(*pImpRec);
+            bDeleteTextImpRec = true;
 
             // the vertical paragraph indents are part of the BoundRect,
             // here we 'remove' them by calculating
@@ -5362,6 +5365,9 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
             {
                 pImpRec->pObj = pOrgObj;
                 rImportData.aRecords.insert( pImpRec );
+                bDeleteImpRec = false;
+                if (pImpRec == pTextImpRec)
+                    bDeleteTextImpRec = false;
             }
 
             if( pTextObj && (pOrgObj != pTextObj) )
@@ -5370,6 +5376,9 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
                 pImpRec->nShapeId |= 0x8000000;
                 pTextImpRec->pObj = pTextObj;
                 rImportData.aRecords.insert( pTextImpRec );
+                bDeleteTextImpRec = false;
+                if (pTextImpRec == pImpRec)
+                    bDeleteImpRec = false;
             }
 
             // entry in the z-order-list in order to complement the pointer to this object
@@ -5383,12 +5392,12 @@ SdrObject* SvxMSDffManager::ProcessObj(SvStream& rSt,
                                 ( ( (sal_uLong)pImpRec->aTextId.nTxBxS ) << 16 )
                                     + pImpRec->aTextId.nSequence, pObj );
         }
-        else
-        {
-            if (pTextImpRec != pImpRec)
-                delete pTextImpRec;
+
+        if (bDeleteImpRec)
             delete pImpRec;
-        }
+
+        if (bDeleteTextImpRec)
+            delete pTextImpRec;
     }
 
     return pObj;
commit e37886a2f6e6eab87373e502f036d56ab85bb445
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 9 19:59:34 2014 +0000

    coverity#708474 Uninitialized scalar field
    
    Change-Id: I0b9fe26b0a2de590042cd9f6e33e06f752d97f1d

diff --git a/sw/source/core/undo/unsort.cxx b/sw/source/core/undo/unsort.cxx
index bbb0a25..503bcc4 100644
--- a/sw/source/core/undo/unsort.cxx
+++ b/sw/source/core/undo/unsort.cxx
@@ -45,8 +45,11 @@ SwSortUndoElement::~SwSortUndoElement()
 }
 
 SwUndoSort::SwUndoSort(const SwPaM& rRg, const SwSortOptions& rOpt)
-    : SwUndo(UNDO_SORT_TXT), SwUndRng(rRg), pUndoTblAttr( 0 ),
-    pRedlData( 0 )
+    : SwUndo(UNDO_SORT_TXT)
+    , SwUndRng(rRg)
+    , pUndoTblAttr(0)
+    , pRedlData(0)
+    , nTblNd(0)
 {
     pSortOpt = new SwSortOptions(rOpt);
 }
commit 624e7b98f5dcc683caa80e12fc6d504217779edb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 9 19:40:20 2014 +0000

    coverity#708475 Uninitialized scalar field
    
    Change-Id: Ic5b4531bb9472b6e6b40f9080f1d748badc6f926

diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 859dcb9..7149c8d 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -2128,10 +2128,17 @@ void SwUndoTblMerge::SaveCollection( const SwTableBox& rBox )
 
 SwUndoTblNumFmt::SwUndoTblNumFmt( const SwTableBox& rBox,
                                     const SfxItemSet* pNewSet )
-    : SwUndo( UNDO_TBLNUMFMT ),
-    pBoxSet( 0 ), pHistory( 0 ), nFmtIdx( NUMBERFORMAT_TEXT )
+    : SwUndo(UNDO_TBLNUMFMT)
+    , pBoxSet(0)
+    , pHistory(0)
+    , nFmtIdx(NUMBERFORMAT_TEXT)
+    , nNewFmtIdx(0)
+    , fNum(0.0)
+    , fNewNum(0.0)
+    , bNewFmt(sal_False)
+    , bNewFml(sal_False)
+    , bNewValue(sal_False)
 {
-    bNewFmt = bNewFml = bNewValue = sal_False;
     nNode = rBox.GetSttIdx();
 
     nNdPos = rBox.IsValidNumTxtNd( 0 == pNewSet );
commit 9f8e0a0ebc923d3104667ae329388d20412c5067
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 9 19:36:41 2014 +0000

    coverity#708456 Uninitialized scalar field
    
    Change-Id: I040d49408581a128025d3b96b313f2c88981c250

diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx
index cf2ffa2..2215b9d 100644
--- a/sw/source/core/text/porlin.cxx
+++ b/sw/source/core/text/porlin.cxx
@@ -76,6 +76,7 @@ SwLinePortion::SwLinePortion( ) :
     pPortion( NULL ),
     nLineLength( 0 ),
     nAscent( 0 ),
+    nWhichPor( POR_LIN ),
     m_bJoinBorderWithPrev(false),
     m_bJoinBorderWithNext(false)
 {
commit fdf3e4bc0847e8f09c4d27712291a82d8ea44aea
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 9 19:34:42 2014 +0000

    coverity#708405 Uninitialized scalar field
    
    Change-Id: I32e2b75ed0ee7c507e149eed97dd178c7b196c4e

diff --git a/sw/inc/crstate.hxx b/sw/inc/crstate.hxx
index 9ab7ae2..9094c40 100644
--- a/sw/inc/crstate.hxx
+++ b/sw/inc/crstate.hxx
@@ -168,6 +168,7 @@ struct SwCrsrMoveState
         bPosCorr( sal_False ),
         bFtnNoInfo( sal_False ),
         bExactOnly( sal_False ),
+        bFillRet( sal_False ),
         bSetInReadOnly( sal_False ),
         bRealWidth( sal_False ),
         b2Lines( sal_False ),
@@ -189,6 +190,7 @@ struct SwCrsrMoveState
         bPosCorr( sal_False ),
         bFtnNoInfo( sal_False ),
         bExactOnly( sal_False ),
+        bFillRet( sal_False ),
         bSetInReadOnly( sal_False ),
         bRealWidth( sal_False ),
         b2Lines( sal_False ),
commit dc4746a25bebcfe93fa65f23907b829ff8174aa0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 9 19:32:59 2014 +0000

    coverity#708299 Uninitialized scalar field
    
    Change-Id: I15b3c6d8a2af7be1fd8cada39c58ed706271f307

diff --git a/svtools/source/control/hyperlabel.cxx b/svtools/source/control/hyperlabel.cxx
index 799941d..8230c53 100644
--- a/svtools/source/control/hyperlabel.cxx
+++ b/svtools/source/control/hyperlabel.cxx
@@ -65,6 +65,10 @@ namespace svt
 
 
     HyperLabelImpl::HyperLabelImpl()
+        : ID(0)
+        , Index(0)
+        , bInteractive(false)
+        , m_bHyperMode(false)
     {
     }
 
commit 1dfbc1b30d10609b08e553dfe578f1ba3d6c4067
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 9 19:29:57 2014 +0000

    coverity#708172 unused m_nEventId member
    
    Change-Id: Ib690511fd3e5fbb176ef2bb9d170ae8850a04309

diff --git a/include/sfx2/tbxctrl.hxx b/include/sfx2/tbxctrl.hxx
index 10177ea..a98f43c 100644
--- a/include/sfx2/tbxctrl.hxx
+++ b/include/sfx2/tbxctrl.hxx
@@ -103,7 +103,6 @@ class SfxFrameStatusListener : public svt::FrameStatusListener
 class SFX2_DLLPUBLIC SfxPopupWindow: public FloatingWindow, public SfxStatusListenerInterface
 {
     sal_Bool                                                                             m_bFloating;
-    sal_uIntPtr                                                                            m_nEventId;
     sal_Bool                                                                             m_bCascading;
     Link                                                                             m_aDeleteLink;
     sal_uInt16                                                                           m_nId;
commit 693be3a6e49af429a3c9d6bc7326f379ef2161b4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Mar 9 19:28:13 2014 +0000

    coverity#707988 Uninitialized scalar field
    
    Change-Id: I06b82d24d4be50e023aa1a1d8aa386d3138d1990

diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 8b74fcf..200d088 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -81,6 +81,7 @@ ScColumn::ScColumn() :
     maBroadcasters(MAXROWCOUNT),
     maCells(MAXROWCOUNT),
     nCol( 0 ),
+    nTab( 0 ),
     pAttrArray( NULL ),
     pDocument( NULL ),
     mbDirtyGroups(true)


More information about the Libreoffice-commits mailing list