[Libreoffice-commits] core.git: 3 commits - dbaccess/source sc/source sw/source

Caolán McNamara caolanm at redhat.com
Wed Jan 17 14:11:12 UTC 2018


 dbaccess/source/ui/tabledesign/TableUndo.cxx |    5 ++---
 sc/source/ui/view/tabvwsha.cxx               |    2 ++
 sw/source/filter/xml/xmlmeta.cxx             |   14 ++++++++++----
 3 files changed, 14 insertions(+), 7 deletions(-)

New commits:
commit c1d54f0455fed02c4874a00c8ad23d8ac5bbed09
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jan 17 13:59:53 2018 +0000

    coverity#1427632 try silencing Using invalid iterator
    
    Change-Id: I74387fd761f170d61e490418f856bfffd5dd8401

diff --git a/dbaccess/source/ui/tabledesign/TableUndo.cxx b/dbaccess/source/ui/tabledesign/TableUndo.cxx
index d11d53f48ad1..c39f0f264a42 100644
--- a/dbaccess/source/ui/tabledesign/TableUndo.cxx
+++ b/dbaccess/source/ui/tabledesign/TableUndo.cxx
@@ -203,13 +203,12 @@ void OTableEditorDelUndoAct::Undo()
 void OTableEditorDelUndoAct::Redo()
 {
     // delete line again
-    sal_uLong nPos;
     std::vector< std::shared_ptr<OTableRow> >* pOriginalRows = pTabEdCtrl->GetRowList();
 
     for (auto const& deletedRow : m_aDeletedRows)
     {
-        nPos = deletedRow->GetPos();
-        pOriginalRows->erase( pOriginalRows->begin()+nPos );
+        auto it = pOriginalRows->begin() + deletedRow->GetPos();
+        pOriginalRows->erase(it);
     }
 
     pTabEdCtrl->DisplayData(pTabEdCtrl->GetCurRow());
commit 61a7c6c405d8578fc2508196d9b7e85de44bd6ed
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jan 17 13:48:49 2018 +0000

    coverity#1427628 Dereference before null check
    
    Change-Id: Ic68d765cc21733ba864b78c135eaae4ec673e7c1

diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index d14e7cade7d4..e391c28ffeda 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -551,6 +551,8 @@ void ScTabViewShell::ExecuteCellFormatDlg(SfxRequest& rReq, const OString &rName
             {
                 const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
 
+                assert(pOutSet);
+
                 const SfxPoolItem* pItem=nullptr;
                 if(pOutSet->GetItemState(SID_ATTR_NUMBERFORMAT_INFO,true,&pItem)==SfxItemState::SET)
                 {
commit 49f05934edd3723666b7c52eccbf4d0c9a688eb7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jan 17 13:37:44 2018 +0000

    coverity#1427629 Unchecked return value
    
    Change-Id: If12d57826817d5ca866ecc14d81b21f494ff4487

diff --git a/sw/source/filter/xml/xmlmeta.cxx b/sw/source/filter/xml/xmlmeta.cxx
index 0cc6a161197b..c85fff068057 100644
--- a/sw/source/filter/xml/xmlmeta.cxx
+++ b/sw/source/filter/xml/xmlmeta.cxx
@@ -145,11 +145,17 @@ void SwXMLImport::SetStatistics(
     // use #pages*10, or guesstimate 250 paragraphs. Additionally
     // guesstimate PROGRESS_BAR_STEPS each for meta+settings, styles,
     // and autostyles.
-    sal_Int32 nProgressReference = 250;
-    if( nTokens & XML_TOK_META_STAT_PARA )
+    bool bSetFallback = true;
+    sal_Int32 nProgressReference;
+    if (nTokens & XML_TOK_META_STAT_PARA)
+    {
         nProgressReference = static_cast<sal_Int32>(aDocStat.nPara);
-    else if ( nTokens & XML_TOK_META_STAT_PAGE )
-        o3tl::checked_multiply<sal_Int32>(aDocStat.nPage, 10, nProgressReference);
+        bSetFallback = false;
+    }
+    else if (nTokens & XML_TOK_META_STAT_PAGE)
+        bSetFallback = o3tl::checked_multiply<sal_Int32>(aDocStat.nPage, 10, nProgressReference);
+    if (bSetFallback)
+        nProgressReference = 250;
     ProgressBarHelper* pProgress = GetProgressBarHelper();
     pProgress->SetReference( nProgressReference + 3*PROGRESS_BAR_STEP );
     pProgress->SetValue( 0 );


More information about the Libreoffice-commits mailing list