[Libreoffice-commits] core.git: 23 commits - connectivity/source cui/source i18npool/source oox/source sal/rtl sc/source sd/source shell/source starmath/source sw/source toolkit/source vcl/generic vcl/source

Caolán McNamara caolanm at redhat.com
Fri Mar 28 06:14:29 PDT 2014


 connectivity/source/drivers/mork/MQueryHelper.cxx                     |    2 
 cui/source/dialogs/linkdlg.cxx                                        |    8 +
 i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx |    7 -
 oox/source/crypto/CryptTools.cxx                                      |    8 +
 sal/rtl/uri.cxx                                                       |    1 
 sc/source/ui/dbgui/pvlaydlg.cxx                                       |    4 
 sc/source/ui/view/prevwsh.cxx                                         |    2 
 sd/source/ui/func/fusumry.cxx                                         |   59 +++++-----
 shell/source/unix/exec/shellexec.cxx                                  |   12 +-
 starmath/source/edit.cxx                                              |    6 -
 sw/source/core/layout/flylay.cxx                                      |    9 +
 sw/source/core/layout/softpagebreak.cxx                               |    2 
 sw/source/core/text/atrstck.cxx                                       |    9 +
 sw/source/core/uibase/utlui/glbltree.cxx                              |    3 
 sw/source/core/unocore/unoport.cxx                                    |    4 
 sw/source/filter/ww8/ww8par6.cxx                                      |    4 
 sw/source/ui/dbui/mmaddressblockpage.cxx                              |    3 
 toolkit/source/awt/vclxtabpagecontainer.cxx                           |    4 
 vcl/generic/print/common_gfx.cxx                                      |    2 
 vcl/source/window/menu.cxx                                            |    5 
 20 files changed, 101 insertions(+), 53 deletions(-)

New commits:
commit 68531dbd88fda13ebcf955da454334d3511dd499
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 12:10:14 2014 +0000

    coverity#707592 Uninitialized scalar variable
    
    Change-Id: Iabbecfd37ca7289c08c00e3588897c118665d62e

diff --git a/vcl/generic/print/common_gfx.cxx b/vcl/generic/print/common_gfx.cxx
index 9988ea8..20484ab 100644
--- a/vcl/generic/print/common_gfx.cxx
+++ b/vcl/generic/print/common_gfx.cxx
@@ -934,7 +934,7 @@ void
 PrinterGfx::PSBinPath (const Point& rCurrent, Point& rOld,
                        pspath_t eType, sal_Int32& nColumn)
 {
-    sal_Char  pPath[48];
+    sal_Char  pPath[48] = {0};
     sal_Int32 nChar;
 
     // create the hex representation of the dx and dy path shift, store the field
commit 67780ee7f37f05ebdec0d330361fa80e1f2e0cc8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 12:01:43 2014 +0000

    coverity#704060 Unchecked return value
    
    Change-Id: I6d0459d8cc8b9801e696cc4ab205b5213df5540e

diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index a9f9570..3677fd7 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -804,7 +804,9 @@ void wwSectionManager::CreateSep(const long nTxtPos, bool /*bMustHaveBreak*/)
     {
         void* pData;
         WW8_CP nTest;
-        pWkb->Get(nTest, pData);
+        bool bSuccess = pWkb->Get(nTest, pData);
+        if (!bSuccess)
+            return;
         OUString sSectionName = mrReader.aLinkStringMap[SVBT16ToShort( ((WW8_WKB*)pData)->nLinkId) ];
         sSectionName = mrReader.ConvertFFileName(sSectionName);
         SwSectionData aSection(FILE_LINK_SECTION, sSectionName);
commit 8cc7aaa6bff7ed7807c8b867c3f9939472b787f7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 11:40:48 2014 +0000

    coverity#705450 Self assignment
    
    Change-Id: I839e77594f6f7dbc516e0e6d08b1cf2517f96ec4

diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx
index b84d81b..bbfe546 100644
--- a/sc/source/ui/view/prevwsh.cxx
+++ b/sc/source/ui/view/prevwsh.cxx
@@ -479,7 +479,7 @@ IMPL_LINK (ScPreviewShell,ScrollHandler, ScrollBar* ,pScroll )
             aRect.Left()    = aPos.X() - 8;
             aRect.Top()     = aMousePos.Y();
             aRect.Right()   = aRect.Left();
-            aRect.Top()     = aRect.Top();
+            aRect.Bottom()  = aRect.Top();
             nAlign          = QUICKHELP_BOTTOM|QUICKHELP_CENTER;
             Help::ShowQuickHelp( pScroll->GetParent(), aRect, aHelpStr, nAlign );
         }
commit 11ea31b5e468e3fd0865d0b4d1137dc514e36cc5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 10:54:41 2014 +0000

    coverity#705205 Missing break in switch
    
    Change-Id: Iaee3b73ceed5df9928514e55d00ac6292b8b2249

diff --git a/sal/rtl/uri.cxx b/sal/rtl/uri.cxx
index 2d6c522..20daac3 100644
--- a/sal/rtl/uri.cxx
+++ b/sal/rtl/uri.cxx
@@ -621,6 +621,7 @@ void SAL_CALL rtl_uriDecode(rtl_uString * pText,
 
     case rtl_UriDecodeToIuri:
         eCharset = RTL_TEXTENCODING_UTF8;
+        //fall-through
     default: // rtl_UriDecodeWithCharset, rtl_UriDecodeStrict
         {
             sal_Unicode const * p = pText->buffer;
commit 51765361b3b9838f7814e9cd3305f83819cb6eb0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 10:52:58 2014 +0000

    coverity#705185 Missing break in switch
    
    Change-Id: I88c2fbea9265b729e21aa2f2d09bea89f91c01cb

diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
index 8a110c0..693f618 100644
--- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
+++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
@@ -667,12 +667,15 @@ DefaultNumberingProvider::makeNumberingString( const Sequence<beans::PropertyVal
                 natNum = NativeNumberMode::NATNUM7;
                 locale.Language = "zh";
                 break;
-          case NUMBER_UPPER_ZH_TW:
-                locale.Country = "TW";
           case NUMBER_UPPER_ZH:
                 natNum = NativeNumberMode::NATNUM8;
                 locale.Language = "zh";
                 break;
+          case NUMBER_UPPER_ZH_TW:
+                natNum = NativeNumberMode::NATNUM8;
+                locale.Language = "zh";
+                locale.Country = "TW";
+                break;
           case NUMBER_TRADITIONAL_JA:
                 natNum = NativeNumberMode::NATNUM8;
                 locale.Language = "ja";
commit c39a664f7ae5ffcb5af820afb06d6eb37e688b80
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 10:47:53 2014 +0000

    coverity#705479 Dereference null return value
    
    Change-Id: Id8b6723e7d3d8a66f5a657628e1467edda509cfa

diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index b8cb874..ca437e6 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -489,9 +489,9 @@ void SmEditWindow::KeyInput(const KeyEvent& rKEvt)
             // have doc-shell modified only for formula input/change and not
             // cursor travelling and such things...
             SmDocShell *pDocShell = GetDoc();
-            if (pDocShell)
-                pDocShell->SetModified( GetEditEngine()->IsModified() );
-
+            EditEngine *pEditEngine = GetEditEngine();
+            if (pDocShell && pEditEngine)
+                pDocShell->SetModified(pEditEngine->IsModified());
             aModifyTimer.Start();
         }
 
commit 224d2153732327611f14af5819bc3f37ff2dc910
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 10:43:36 2014 +0000

    coverity#705497 Dereference null return value
    
    Change-Id: I1dbbda7e2be6426409ce8f03d6570fec451a01b5

diff --git a/sw/source/core/layout/softpagebreak.cxx b/sw/source/core/layout/softpagebreak.cxx
index 7122452..e09f78d 100644
--- a/sw/source/core/layout/softpagebreak.cxx
+++ b/sw/source/core/layout/softpagebreak.cxx
@@ -47,7 +47,7 @@ void SwTxtNode::fillSoftPageBreakList( SwSoftPageBreakList& rBreak ) const
             {
                 // No soft page break if I'm in a table but the first content frame
                 // at my page is not in a table
-                if( !pFirst2->IsInTab() )
+                if( !pFirst2 || !pFirst2->IsInTab() )
                     continue;
                 const SwLayoutFrm *pRow = pFrm->GetUpper();
                 // Looking for the "most upper" row frame,
commit 0804c8239f8fb1b576485810030debd88ba12131
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 10:41:50 2014 +0000

    coverity#705502 Dereference null return value
    
    Change-Id: I5f41ff8017879a75f088fc0aa1b8ce99f935a46f

diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx
index cfe91f8..a623d45 100644
--- a/sw/source/core/text/atrstck.cxx
+++ b/sw/source/core/text/atrstck.cxx
@@ -610,15 +610,20 @@ void SwAttrHandler::ActivateTop( SwFont& rFnt, const sal_uInt16 nAttr )
     const SwTxtAttr* pTopAt = aAttrStack[ nStackPos ].Top();
     if ( pTopAt )
     {
+        const SfxPoolItem* pItemNext(NULL);
+
         // check if top attribute is collection of attributes
         if ( RES_TXTATR_INETFMT == pTopAt->Which() ||
              RES_TXTATR_CHARFMT == pTopAt->Which() ||
              RES_TXTATR_AUTOFMT == pTopAt->Which() )
         {
             const SfxItemSet* pSet = CharFmt::GetItemSet( pTopAt->GetAttr() );
-            const SfxPoolItem* pItemNext;
-            pSet->GetItemState( nAttr, RES_TXTATR_AUTOFMT != pTopAt->Which(), &pItemNext );
+            if (pSet)
+                pSet->GetItemState( nAttr, RES_TXTATR_AUTOFMT != pTopAt->Which(), &pItemNext );
+        }
 
+        if (pItemNext)
+        {
             Color aColor;
             if ( lcl_ChgHyperLinkColor( *pTopAt, *pItemNext, mpShell, &aColor ) )
             {
commit da0581b32c8b93bbdd4abc14e30010bab7873336
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 10:38:42 2014 +0000

    coverity#705507 Dereference null return value
    
    Change-Id: I766d6c98371392a75c7d1097b7a3516a43d3fbe4

diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx
index 03e853f..c492eb0 100644
--- a/sw/source/core/unocore/unoport.cxx
+++ b/sw/source/core/unocore/unoport.cxx
@@ -670,7 +670,9 @@ uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion:
             }
             else
             {
-                  const SfxItemPropertySimpleEntry* pEntry = rPropMap.getByName( pProp[i] );
+                const SfxItemPropertySimpleEntry* pEntry = rPropMap.getByName( pProp[i] );
+                if (!pEntry)
+                    throw beans::UnknownPropertyException(OUString( "Unknown property: " ) + pProp[i], static_cast < cppu::OWeakObject * > ( this ) );
                 aResult.State  = pPropertyStates[i];
 
                 aResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_FAILURE;
commit 2c345da3725dcd73704fdc990e57fc7aa9a7f99e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 10:36:25 2014 +0000

    coverity#736137 Dereference null return value
    
    Change-Id: Ie66e71e2aff49db5c0192fd0e787231081d24060

diff --git a/connectivity/source/drivers/mork/MQueryHelper.cxx b/connectivity/source/drivers/mork/MQueryHelper.cxx
index 8f09d46..e6293c7 100644
--- a/connectivity/source/drivers/mork/MQueryHelper.cxx
+++ b/connectivity/source/drivers/mork/MQueryHelper.cxx
@@ -231,6 +231,8 @@ sal_Int32 MQueryHelper::executeQuery(OConnection* xConnection)
     }
     MorkTableMap::iterator tableIter;
     MorkTableMap *Tables = xMork->getTables( 0x80 );
+    if (!Tables)
+        return -1;
     MorkRowMap *Rows = 0;
     MorkRowMap::iterator rowIter;
 
commit dc671f6d3ae6d5c23f6a44d2efdc0851365ff529
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 10:33:03 2014 +0000

    coverity#736138 Dereference null return value
    
    Change-Id: I931d2f5061a5fb048e2fd61267d4f8acb90f2cf5

diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx
index 9625ebb..323354c 100644
--- a/cui/source/dialogs/linkdlg.cxx
+++ b/cui/source/dialogs/linkdlg.cxx
@@ -174,8 +174,12 @@ IMPL_LINK( SvBaseLinksDlg, LinksSelectHdl, SvTabListBox *, pSvTabListBox )
                 pEntry = i == 0 ? pSvTabListBox->FirstSelected() :
                                     pSvTabListBox->NextSelected(pEntry);
                 DBG_ASSERT(pEntry, "Wo ist der Entry?");
+                if (!pEntry)
+                    continue;
                 pLink = (SvBaseLink*)pEntry->GetUserData();
                 DBG_ASSERT(pLink, "Wo ist der Link?");
+                if (!pLink)
+                    continue;
                 if( (OBJECT_CLIENT_FILE & pLink->GetObjType()) != OBJECT_CLIENT_FILE )
                     pSvTabListBox->Select( pEntry, false );
 
commit 0a4f224c0ecb1871f0c53c4163a2ffb47f11bfd2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 10:32:19 2014 +0000

    coverity#736139 Dereference null return value
    
    Change-Id: Ibb178c04119373ad848745fe91fea70cbbb0e8a5

diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx
index b7c95ff..9625ebb 100644
--- a/cui/source/dialogs/linkdlg.cxx
+++ b/cui/source/dialogs/linkdlg.cxx
@@ -373,8 +373,12 @@ IMPL_LINK( SvBaseLinksDlg, ChangeSourceClickHdl, PushButton *, pPushButton )
                         Links().FirstSelected() :
                         Links().NextSelected( pEntry );
                     DBG_ASSERT(pEntry,"Where is the entry?");
+                    if (!pEntry)
+                        continue;
                     pLink = (SvBaseLink*)pEntry->GetUserData();
                     DBG_ASSERT(pLink,"Where is the link?");
+                    if (!pLink)
+                        continue;
                     pLinkMgr->GetDisplayNames( pLink, &sType, &sFile, &sLinkName, &sFilter );
                     INetURLObject aUrl_(sFile);
                     INetURLObject aUrl2(aPath, INET_PROT_FILE);
commit f7d3344fdf45f90839711b250b15960f118ab6e3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 10:30:30 2014 +0000

    coverity#736147 Dereference null return value
    
    Change-Id: Ibcf624be5787b0bf8fd7b0697a4dc9377a22d825

diff --git a/sd/source/ui/func/fusumry.cxx b/sd/source/ui/func/fusumry.cxx
index f149353..f8ef7f0 100644
--- a/sd/source/ui/func/fusumry.cxx
+++ b/sd/source/ui/func/fusumry.cxx
@@ -183,40 +183,43 @@ void FuSummaryPage::DoExecute( SfxRequest& )
         }
     }
 
-    if (pSummaryPage)
-    {
-        SdrTextObj* pTextObj = (SdrTextObj*) pSummaryPage->GetPresObj(PRESOBJ_OUTLINE);
+    if (!pSummaryPage)
+        return;
 
-        // remove hard break- and character attributes
-        SfxItemSet aEmptyEEAttr(mpDoc->GetPool(), EE_ITEMS_START, EE_ITEMS_END);
-        sal_Int32 nParaCount = pOutl->GetParagraphCount();
+    SdrTextObj* pTextObj = (SdrTextObj*) pSummaryPage->GetPresObj(PRESOBJ_OUTLINE);
 
-        for (sal_Int32 nPara = 0; nPara < nParaCount; nPara++)
-        {
-            pOutl->SetStyleSheet( nPara, pStyle );
-            pOutl->QuickRemoveCharAttribs(nPara);
-            pOutl->SetParaAttribs(nPara, aEmptyEEAttr);
-            pOutl->SetDepth(pOutl->GetParagraph(nPara), 0);
-        }
+    if (!pTextObj)
+        return;
+
+    // remove hard break- and character attributes
+    SfxItemSet aEmptyEEAttr(mpDoc->GetPool(), EE_ITEMS_START, EE_ITEMS_END);
+    sal_Int32 nParaCount = pOutl->GetParagraphCount();
+
+    for (sal_Int32 nPara = 0; nPara < nParaCount; nPara++)
+    {
+        pOutl->SetStyleSheet( nPara, pStyle );
+        pOutl->QuickRemoveCharAttribs(nPara);
+        pOutl->SetParaAttribs(nPara, aEmptyEEAttr);
+        pOutl->SetDepth(pOutl->GetParagraph(nPara), 0);
+    }
 
-        pTextObj->SetOutlinerParaObject( pOutl->CreateParaObject() );
-        pTextObj->SetEmptyPresObj(false);
+    pTextObj->SetOutlinerParaObject( pOutl->CreateParaObject() );
+    pTextObj->SetEmptyPresObj(false);
 
-        // remove hard attributes (Flag to sal_True)
-        SfxItemSet aAttr(mpDoc->GetPool());
-        aAttr.Put(XLineStyleItem(XLINE_NONE));
-        aAttr.Put(XFillStyleItem(XFILL_NONE));
-        pTextObj->SetMergedItemSet(aAttr);
+    // remove hard attributes (Flag to sal_True)
+    SfxItemSet aAttr(mpDoc->GetPool());
+    aAttr.Put(XLineStyleItem(XLINE_NONE));
+    aAttr.Put(XFillStyleItem(XFILL_NONE));
+    pTextObj->SetMergedItemSet(aAttr);
 
-        if( bBegUndo )
-            mpView->EndUndo();
-        delete pOutl;
+    if( bBegUndo )
+        mpView->EndUndo();
+    delete pOutl;
 
-        DrawViewShell* pDrawViewShell= dynamic_cast< DrawViewShell* >( mpViewShell );
-        if(pDrawViewShell)
-        {
-            pDrawViewShell->SwitchPage( (pSummaryPage->GetPageNum() - 1) / 2);
-        }
+    DrawViewShell* pDrawViewShell= dynamic_cast< DrawViewShell* >( mpViewShell );
+    if(pDrawViewShell)
+    {
+        pDrawViewShell->SwitchPage( (pSummaryPage->GetPageNum() - 1) / 2);
     }
 }
 
commit 10787356d93c0a913f4f6cd65920c57b3ec3e701
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 10:27:53 2014 +0000

    coverity#736157 Dereference null return value
    
    Change-Id: Ibc6e17e4d916ae9e1664e8c9149a978072dae0ac

diff --git a/toolkit/source/awt/vclxtabpagecontainer.cxx b/toolkit/source/awt/vclxtabpagecontainer.cxx
index ef57167..4b87662 100644
--- a/toolkit/source/awt/vclxtabpagecontainer.cxx
+++ b/toolkit/source/awt/vclxtabpagecontainer.cxx
@@ -60,12 +60,12 @@ void SAL_CALL VCLXTabPageContainer::draw( sal_Int32 nX, sal_Int32 nY ) throw(Run
     if ( pTabControl )
     {
         TabPage *pTabPage = pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >(  pTabControl->GetCurPageId( ) ) );
-        if ( pTabPage )
+        OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
+        if (pTabPage && pDev)
         {
             ::Point aPos( nX, nY );
             ::Size  aSize = pTabPage->GetSizePixel();
 
-            OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
             aPos  = pDev->PixelToLogic( aPos );
             aSize = pDev->PixelToLogic( aSize );
 
commit f1fe85ec8df1f246e61e93795b82d93c1d90cdb6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 10:25:23 2014 +0000

    coverity#736161 Dereference null return value
    
    Change-Id: I6ce18d8446944e6b491ccd3973c5fa7e1413f073

diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 430bc46..29500e3 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -1442,6 +1442,9 @@ void ImplCopyItem( Menu* pThis, const Menu& rMenu, sal_uInt16 nPos, sal_uInt16 n
 
         MenuItemData* pData = rMenu.GetItemList()->GetData( nId );
 
+        if (!pData)
+            return;
+
         if ( eType == MENUITEM_STRINGIMAGE )
             pThis->InsertItem( nId, pData->aText, pData->aImage, pData->nBits, pData->sIdent, nNewPos );
         else if ( eType == MENUITEM_STRING )
commit 315eea127319e57fa98ddc87103dc8a9c99f33c7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 10:24:16 2014 +0000

    coverity#736162 Dereference null return value
    
    Change-Id: If2a8f2ba79f3efa557cacb29553ba70e233f88f5

diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 8b52b46..430bc46 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -3528,7 +3528,7 @@ void PopupMenu::SelectEntry( sal_uInt16 nId )
         {
             size_t nPos = 0;
             MenuItemData* pData = GetItemList()->GetData( nId, nPos );
-            if ( pData->pSubMenu )
+            if (pData && pData->pSubMenu)
                 ImplGetFloatingWindow()->ChangeHighlightItem( nPos, true );
             else
                 ImplGetFloatingWindow()->EndExecute( nId );
commit 2e82733434cb1488cecd41d438a10b7b02a436fc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 10:21:30 2014 +0000

    coverity#982764 Dereference null return value
    
    Change-Id: Ib0f01bf529a739e5f92cd41979c18d76d7b545d1

diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx
index 104462b..6dfee0c 100644
--- a/sc/source/ui/dbgui/pvlaydlg.cxx
+++ b/sc/source/ui/dbgui/pvlaydlg.cxx
@@ -395,10 +395,10 @@ void ScPivotLayoutDlg::AddField( size_t nFromIndex, ScPivotFieldType eToType, co
     if (!bAllowed)
         return;
 
+    size_t nAt = 0;
     ScDPFieldControlBase* toWnd = GetFieldWindow(eToType);
     if (!toWnd)
         return;
-    size_t nAt = 0;
     ScDPFieldControlBase* rmWnd1 = NULL;
     ScDPFieldControlBase* rmWnd2 = NULL;
     GetOtherFieldWindows(eToType, rmWnd1, rmWnd2);
@@ -454,6 +454,8 @@ void ScPivotLayoutDlg::AppendField(size_t nFromIndex, ScPivotFieldType eToType)
 
     size_t nAt = 0;
     ScDPFieldControlBase* toWnd = GetFieldWindow(eToType);
+    if (!toWnd)
+        return;
     ScDPFieldControlBase* rmWnd1 = NULL;
     ScDPFieldControlBase* rmWnd2 = NULL;
     GetOtherFieldWindows(eToType, rmWnd1, rmWnd2);
commit a69209a4152c6e8a64e8467dffa9c4330fd2112f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 10:20:21 2014 +0000

    coverity#982765 Dereference null return value
    
    Change-Id: I2fd5d432aff737016948a4f7bd45888cf6f4dba2

diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx
index 8cbbcdf..104462b 100644
--- a/sc/source/ui/dbgui/pvlaydlg.cxx
+++ b/sc/source/ui/dbgui/pvlaydlg.cxx
@@ -395,8 +395,10 @@ void ScPivotLayoutDlg::AddField( size_t nFromIndex, ScPivotFieldType eToType, co
     if (!bAllowed)
         return;
 
-    size_t nAt = 0;
     ScDPFieldControlBase* toWnd = GetFieldWindow(eToType);
+    if (!toWnd)
+        return;
+    size_t nAt = 0;
     ScDPFieldControlBase* rmWnd1 = NULL;
     ScDPFieldControlBase* rmWnd2 = NULL;
     GetOtherFieldWindows(eToType, rmWnd1, rmWnd2);
commit 22a7f8b1f5a4955e5b1500e1f58a7cdc72f1c5d9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 10:14:54 2014 +0000

    coverity#982766 Dereference null return value
    
    Change-Id: Ic9efce80ea2c2489e3ef070ac4c6106c811e9889

diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx
index e1a923d..6ecad95 100644
--- a/shell/source/unix/exec/shellexec.cxx
+++ b/shell/source/unix/exec/shellexec.cxx
@@ -258,12 +258,16 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar
 #else
         aBuffer.makeStringAndClear();
 #endif
-    if ( 0 != pclose(popen(cmd.getStr(), "w")) )
+    FILE *pLaunch = popen(cmd.getStr(), "w");
+    if ( pLaunch != NULL )
     {
-        int nerr = errno;
-        throw SystemShellExecuteException(OUString::createFromAscii( strerror( nerr ) ),
-            static_cast < XSystemShellExecute * > (this), nerr );
+        if ( 0 == pclose( pLaunch ) )
+            return;
     }
+
+    int nerr = errno;
+    throw SystemShellExecuteException(OUString::createFromAscii( strerror( nerr ) ),
+        static_cast < XSystemShellExecute * > (this), nerr );
 }
 
 // XServiceInfo
commit 1ada4551539fee3b8dee095ba53bbcbcfcc34c43
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 10:10:51 2014 +0000

    coverity#982767 Dereference null return value
    
    Change-Id: I4c07d531a081b2011cb1abd35a03038500d889c3

diff --git a/sw/source/core/uibase/utlui/glbltree.cxx b/sw/source/core/uibase/utlui/glbltree.cxx
index 1738241..b72dfb3 100644
--- a/sw/source/core/uibase/utlui/glbltree.cxx
+++ b/sw/source/core/uibase/utlui/glbltree.cxx
@@ -635,6 +635,9 @@ void    SwGlobalTree::Display(bool bOnlyUpdateUserData)
             SwGlblDocContent* pCont = (*pSwGlblDocContents)[i];
             pEntry->SetUserData(pCont);
             pEntry = Next(pEntry);
+            assert(pEntry);
+            if (!pEntry)
+                break;
         }
     }
     else
commit 7cd67196c2ef2ac8ef9f12694a7bcead119aeaa9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 10:09:06 2014 +0000

    coverity#1130422 Dereference null return value
    
    Change-Id: I6693a9f98d2b51f255081d768672622fcd00f15d

diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index 2991cca..8549857 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -1357,7 +1357,8 @@ void AddressMultiLineEdit::InsertNewEntry( const OUString& rStr )
 
     // select the new entry
     pAttrib = pTextEngine->FindCharAttrib(TextPaM(nPara, nIndex),TEXTATTR_PROTECTED);
-    TextSelection aEntrySel(TextPaM(nPara, nIndex), TextPaM(nPara, pAttrib->GetEnd()));
+    sal_uInt16 nEnd = pAttrib ? pAttrib->GetEnd() : nIndex;
+    TextSelection aEntrySel(TextPaM(nPara, nIndex), TextPaM(nPara, nEnd));
     pTextView->SetSelection(aEntrySel);
     Invalidate();
     Modify();
commit 5fd544a713215d2b3dc7239abe0fe3b5ee8da883
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 10:02:02 2014 +0000

    coverity#1130427 Dereference null return value
    
    Change-Id: Iefc35c0de5224d66f362b6ba958fbffcf0c654bb

diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index a956e8b..080d5f7 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -1049,9 +1049,12 @@ sal_Bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, sal_Bool bMove )
                         const SwPageFrm *pPg;
                         if ( pUp->GetUpper() != (pPg = pFly->FindPageFrm()) )
                             pUp = pPg->FindBodyCont();
-                        rRect = pUp->GetUpper()->Frm();
-                        (rRect.*fnRect->fnSetTop)( (pUp->*fnRect->fnGetPrtTop)() );
-                        (rRect.*fnRect->fnSetBottom)((pUp->*fnRect->fnGetPrtBottom)());
+                        if (pUp)
+                        {
+                            rRect = pUp->GetUpper()->Frm();
+                            (rRect.*fnRect->fnSetTop)( (pUp->*fnRect->fnGetPrtTop)() );
+                            (rRect.*fnRect->fnSetBottom)((pUp->*fnRect->fnGetPrtBottom)());
+                        }
                     }
                     else
                     {
commit 75af1c483bc16b7cda2289a14dd2d240f24ecaff
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 09:59:15 2014 +0000

    coverity#1130428 Dereference null return value
    
    Change-Id: I557aeb40b4209e2f77383143a8c2665bffea110c

diff --git a/oox/source/crypto/CryptTools.cxx b/oox/source/crypto/CryptTools.cxx
index 6901581..6994ca4 100644
--- a/oox/source/crypto/CryptTools.cxx
+++ b/oox/source/crypto/CryptTools.cxx
@@ -9,6 +9,7 @@
  */
 
 #include "oox/crypto/CryptTools.hxx"
+#include <com/sun/star/uno/RuntimeException.hpp>
 
 namespace oox {
 namespace core {
@@ -86,14 +87,17 @@ void Crypto::setupContext(vector<sal_uInt8>& key, vector<sal_uInt8>& iv, CryptoT
             break;
     }
 
-    PK11SlotInfo* aSlot( PK11_GetBestSlot( mechanism, NULL ) );
+    PK11SlotInfo* pSlot( PK11_GetBestSlot( mechanism, NULL ) );
+
+    if (!pSlot)
+        throw css::uno::RuntimeException("NSS Slot failure", css::uno::Reference<css::uno::XInterface>());
 
     SECItem keyItem;
     keyItem.type = siBuffer;
     keyItem.data = &key[0];
     keyItem.len  = key.size();
 
-    mSymKey = PK11_ImportSymKey( aSlot, mechanism, PK11_OriginUnwrap, CKA_ENCRYPT, &keyItem, NULL );
+    mSymKey = PK11_ImportSymKey( pSlot, mechanism, PK11_OriginUnwrap, CKA_ENCRYPT, &keyItem, NULL );
     mSecParam = PK11_ParamFromIV( mechanism, pIvItem );
     mContext = PK11_CreateContextBySymKey( mechanism, operation, mSymKey, mSecParam );
 }


More information about the Libreoffice-commits mailing list