New Defects reported by Coverity Scan for LibreOffice

scan-admin at coverity.com scan-admin at coverity.com
Fri Mar 27 07:29:55 UTC 2020


Hi,

Please find the latest report on new defect(s) introduced to LibreOffice found with Coverity Scan.

12 new defect(s) introduced to LibreOffice found with Coverity Scan.
1 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 12 of 12 defect(s)


** CID 1460978:  Error handling issues  (CHECKED_RETURN)
/sw/source/uibase/utlui/content.cxx: 2372 in SwContentTree::HasContentChanged()()


________________________________________________________________________________________________________
*** CID 1460978:  Error handling issues  (CHECKED_RETURN)
/sw/source/uibase/utlui/content.cxx: 2372 in SwContentTree::HasContentChanged()()
2366                         {
2367                             bRemoveChildren = true;
2368                         }
2369                         else
2370                         {
2371                             std::unique_ptr<weld::TreeIter> xChild(m_xTreeView->make_iterator(xEntry.get()));
>>>     CID 1460978:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "iter_children" without checking return value (as is done elsewhere 36 out of 40 times).
2372                             m_xTreeView->iter_children(*xChild);
2373                             for (size_t j = 0; j < nChildCount; ++j)
2374                             {
2375                                 const SwContent* pCnt = pArrType->GetMember(j);
2376                                 OUString sSubId(OUString::number(reinterpret_cast<sal_Int64>(pCnt)));
2377                                 m_xTreeView->set_id(*xChild, sSubId);

** CID 1460977:  Error handling issues  (CHECKED_RETURN)
/dbaccess/source/ui/dlg/indexdialog.cxx: 360 in dbaui::DbaIndexDialog::OnRenameIndex()()


________________________________________________________________________________________________________
*** CID 1460977:  Error handling issues  (CHECKED_RETURN)
/dbaccess/source/ui/dlg/indexdialog.cxx: 360 in dbaui::DbaIndexDialog::OnRenameIndex()()
354     
355         void DbaIndexDialog::OnRenameIndex()
356         {
357             // the selected index
358             std::unique_ptr<weld::TreeIter> xSelected(m_xIndexList->make_iterator());
359             // the selected index
>>>     CID 1460977:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "get_selected" without checking return value (as is done elsewhere 64 out of 80 times).
360             m_xIndexList->get_selected(xSelected.get());
361     
362             // save the changes made 'til here
363             // Upon leaving the edit mode, the control will be re-initialized with the
364             // settings from the current entry
365             implSaveModified(false);

** CID 1460976:  Error handling issues  (CHECKED_RETURN)
/sw/source/uibase/utlui/content.cxx: 1411 in SwContentTree::remove(const weld::TreeIter &)()


________________________________________________________________________________________________________
*** CID 1460976:  Error handling issues  (CHECKED_RETURN)
/sw/source/uibase/utlui/content.cxx: 1411 in SwContentTree::remove(const weld::TreeIter &)()
1405     
1406     void SwContentTree::remove(const weld::TreeIter& rIter)
1407     {
1408         if (m_xTreeView->iter_has_child(rIter))
1409         {
1410             std::unique_ptr<weld::TreeIter> xChild = m_xTreeView->make_iterator(&rIter);
>>>     CID 1460976:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "iter_children" without checking return value (as is done elsewhere 36 out of 40 times).
1411             m_xTreeView->iter_children(*xChild);
1412             remove(*xChild);
1413         }
1414         m_xTreeView->remove(rIter);
1415         --m_nEntryCount;
1416     }

** CID 1460975:  Error handling issues  (CHECKED_RETURN)
/dbaccess/source/ui/dlg/indexdialog.cxx: 384 in dbaui::DbaIndexDialog::OnResetIndex()()


________________________________________________________________________________________________________
*** CID 1460975:  Error handling issues  (CHECKED_RETURN)
/dbaccess/source/ui/dlg/indexdialog.cxx: 384 in dbaui::DbaIndexDialog::OnResetIndex()()
378     
379         void DbaIndexDialog::OnResetIndex()
380         {
381             // the selected index
382             std::unique_ptr<weld::TreeIter> xSelected(m_xIndexList->make_iterator());
383             // the selected index
>>>     CID 1460975:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "get_selected" without checking return value (as is done elsewhere 64 out of 80 times).
384             m_xIndexList->get_selected(xSelected.get());
385             OSL_ENSURE(xSelected, "DbaIndexDialog::OnResetIndex: invalid call!");
386     
387             Indexes::iterator aResetPos = m_xIndexes->begin() + m_xIndexList->get_id(*xSelected).toUInt32();
388     
389             if (aResetPos->isNew())

** CID 1460974:  Error handling issues  (CHECKED_RETURN)
/sw/source/ui/misc/glossary.cxx: 509 in SwGlossaryDlg::MenuHdl(const rtl::OString &)()


________________________________________________________________________________________________________
*** CID 1460974:  Error handling issues  (CHECKED_RETURN)
/sw/source/ui/misc/glossary.cxx: 509 in SwGlossaryDlg::MenuHdl(const rtl::OString &)()
503             SwNewGlosNameDlg aNewNameDlg(this, m_xNameED->get_text(), m_xShortNameEdit->get_text());
504             if (aNewNameDlg.run() == RET_OK && m_pGlossaryHdl->Rename(m_xShortNameEdit->get_text(),
505                                                                     aNewNameDlg.GetNewShort(),
506                                                                     aNewNameDlg.GetNewName()))
507             {
508                 std::unique_ptr<weld::TreeIter> xEntry = m_xCategoryBox->make_iterator();
>>>     CID 1460974:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "get_selected" without checking return value (as is done elsewhere 64 out of 80 times).
509                 m_xCategoryBox->get_selected(xEntry.get());
510                 std::unique_ptr<weld::TreeIter> xOldEntry = m_xCategoryBox->make_iterator(xEntry.get());
511                 if (m_xCategoryBox->get_iter_depth(*xEntry))
512                     m_xCategoryBox->iter_parent(*xEntry);
513     
514                 std::unique_ptr<weld::TreeIter> xNewEntry = m_xCategoryBox->make_iterator();

** CID 1460973:  Null pointer dereferences  (FORWARD_NULL)


________________________________________________________________________________________________________
*** CID 1460973:  Null pointer dereferences  (FORWARD_NULL)
/sw/source/uibase/utlui/glbltree.cxx: 954 in SwGlobalTree::DoubleClickHdl(weld::TreeView &)()
948     }
949     
950     IMPL_LINK_NOARG( SwGlobalTree, DoubleClickHdl, weld::TreeView&, bool)
951     {
952         int nEntry = m_xTreeView->get_cursor_index();
953         SwGlblDocContent* pCont = nEntry != -1 ? reinterpret_cast<SwGlblDocContent*>(m_xTreeView->get_id(nEntry).toInt64()) : nullptr;
>>>     CID 1460973:  Null pointer dereferences  (FORWARD_NULL)
>>>     Passing null pointer "pCont" to "GetType", which dereferences it.
954         if (pCont->GetType() == GLBLDOC_SECTION)
955             OpenDoc(pCont);
956         else
957         {
958             GotoContent(pCont);
959             m_pActiveShell->GetView().GetEditWin().GrabFocus();

** CID 1460972:  Error handling issues  (CHECKED_RETURN)
/sw/source/uibase/utlui/content.cxx: 1926 in SwContentTree::Display(bool)()


________________________________________________________________________________________________________
*** CID 1460972:  Error handling issues  (CHECKED_RETURN)
/sw/source/uibase/utlui/content.cxx: 1926 in SwContentTree::Display(bool)()
1920                             }
1921                             if (!xSelEntry || lcl_IsContentType(*xSelEntry, *m_xTreeView))
1922                                 xSelEntry = std::move(xTemp);
1923                         }
1924                     }
1925     
>>>     CID 1460972:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "iter_next_sibling" without checking return value (as is done elsewhere 43 out of 45 times).
1926                     m_xTreeView->iter_next_sibling(*xEntry);
1927                 }
1928     
1929                 if (!xSelEntry)
1930                 {
1931                     nOldScrollPos = 0;

** CID 1460971:  Error handling issues  (CHECKED_RETURN)
/sw/source/uibase/utlui/content.cxx: 2382 in SwContentTree::HasContentChanged()()


________________________________________________________________________________________________________
*** CID 1460971:  Error handling issues  (CHECKED_RETURN)
/sw/source/uibase/utlui/content.cxx: 2382 in SwContentTree::HasContentChanged()()
2376                                 OUString sSubId(OUString::number(reinterpret_cast<sal_Int64>(pCnt)));
2377                                 m_xTreeView->set_id(*xChild, sSubId);
2378                                 OUString sEntryText = m_xTreeView->get_text(*xChild);
2379                                 if( sEntryText != pCnt->GetName() &&
2380                                     !(sEntryText == m_sSpace && pCnt->GetName().isEmpty()))
2381                                     bRemoveChildren = true;
>>>     CID 1460971:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "iter_next" without checking return value (as is done elsewhere 67 out of 69 times).
2382                                 m_xTreeView->iter_next(*xChild);
2383                             }
2384                         }
2385                         if (bRemoveChildren)
2386                         {
2387                             std::unique_ptr<weld::TreeIter> xRemove(m_xTreeView->make_iterator(xEntry.get()));

** CID 1460970:  Error handling issues  (CHECKED_RETURN)
/sw/source/uibase/utlui/content.cxx: 1895 in SwContentTree::Display(bool)()


________________________________________________________________________________________________________
*** CID 1460970:  Error handling issues  (CHECKED_RETURN)
/sw/source/uibase/utlui/content.cxx: 1895 in SwContentTree::Display(bool)()
1889                 m_xTreeView->thaw();
1890     
1891                 // restore visual expanded tree state
1892                 for (const auto& rNode : aNodesToExpand)
1893                     m_xTreeView->expand_row(*rNode);
1894     
>>>     CID 1460970:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "get_iter_first" without checking return value (as is done elsewhere 70 out of 76 times).
1895                 m_xTreeView->get_iter_first(*xEntry);
1896                 for (ContentTypeId nCntType : o3tl::enumrange<ContentTypeId>())
1897                 {
1898                     sal_Int32 nExpandOptions = (State::HIDDEN == m_eState)
1899                                                 ? m_nHiddenBlock
1900                                                 : m_nActiveBlock;

** CID 1460969:  Uninitialized members  (UNINIT_CTOR)
/dbaccess/source/core/dataaccess/ModelImpl.cxx: 409 in dbaccess::ODatabaseModelImpl::ODatabaseModelImpl(const rtl::OUString &, const com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> &, dbaccess::ODatabaseContext &)()


________________________________________________________________________________________________________
*** CID 1460969:  Uninitialized members  (UNINIT_CTOR)
/dbaccess/source/core/dataaccess/ModelImpl.cxx: 409 in dbaccess::ODatabaseModelImpl::ODatabaseModelImpl(const rtl::OUString &, const com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> &, dbaccess::ODatabaseContext &)()
403                 ,m_bDocumentReadOnly(false)
404                 ,m_bMacroCallsSeenWhileLoading(false)
405                 ,m_pSharedConnectionManager(nullptr)
406                 ,m_nControllerLockCount(0)
407     {
408         impl_construct_nothrow();
>>>     CID 1460969:  Uninitialized members  (UNINIT_CTOR)
>>>     Non-static class member "m_nScriptingSignatureState" is not initialized in this constructor nor in any functions that it calls.
409     }
410     
411     ODatabaseModelImpl::~ODatabaseModelImpl()
412     {
413     }
414     

** CID 1460968:  Error handling issues  (CHECKED_RETURN)
/sw/source/uibase/utlui/content.cxx: 1106 in <unnamed>::IsAllExpanded(const weld::TreeView &, const weld::TreeIter &)()


________________________________________________________________________________________________________
*** CID 1460968:  Error handling issues  (CHECKED_RETURN)
/sw/source/uibase/utlui/content.cxx: 1106 in <unnamed>::IsAllExpanded(const weld::TreeView &, const weld::TreeIter &)()
1100                 return false;
1101     
1102             if (!rContentTree.iter_has_child(rEntry))
1103                 return false;
1104     
1105             std::unique_ptr<weld::TreeIter> xChild(rContentTree.make_iterator(&rEntry));
>>>     CID 1460968:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "iter_children" without checking return value (as is done elsewhere 36 out of 40 times).
1106             rContentTree.iter_children(*xChild);
1107     
1108             do
1109             {
1110                 if (rContentTree.iter_has_child(*xChild) || rContentTree.get_children_on_demand(*xChild))
1111                 {

** CID 1460967:  Incorrect expression  (DIVIDE_BY_ZERO)
/sc/source/ui/miscdlgs/filldlg.cxx: 209 in ScFillSeriesDlg::CheckValues()()


________________________________________________________________________________________________________
*** CID 1460967:  Incorrect expression  (DIVIDE_BY_ZERO)
/sc/source/ui/miscdlgs/filldlg.cxx: 209 in ScFillSeriesDlg::CheckValues()()
203         {
204             SCSIZE nStepAmount = ( theFillDir == FILL_TO_BOTTOM || theFillDir == FILL_TO_TOP ) ?
205                         m_nSelectHeight - 1 : m_nSelectWidth - 1 ;
206             if ( aStartStr.isEmpty() )
207                 fStartVal = fEndVal - fIncrement * nStepAmount;
208             if ( aIncStr.isEmpty() )
>>>     CID 1460967:  Incorrect expression  (DIVIDE_BY_ZERO)
>>>     In expression "(this->fEndVal - this->fStartVal) / nStepAmount", division by expression "nStepAmount" which may be zero has undefined behavior.
209                 fIncrement = (fEndVal - fStartVal) / nStepAmount;
210         }
211         else
212         {
213             if ( aStartStr.isEmpty() || m_xBtnAutoFill->get_active() )
214                 fStartVal = MAXDOUBLE;


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://u2389337.ct.sendgrid.net/ls/click?upn=nJaKvJSIH-2FPAfmty-2BK5tYpPklAc1eEA-2F1zfUjH6teExViPHTTReBArhCRZ3BE4kCjKjDqn2Dq3ZyEbAvAs31gRpU3vMPHDnoSx68vDAWjNU-3D3RMd_OTq2XUZbbipYjyLSo6GRo-2FpVxQ9OzkDINu9UTS-2FQhSdO0F0jQniitrGlNxDIzPJifvfAG8y3-2FX63aWpXP8DLzWDPxaS-2FB-2BpVnQq9ATYFvBMEdSnkiiZPB69HZery-2F9Uc7cDHCD4o2m7OojztEbL6gnad5-2BPHaoArkLk6YDhtXTVd1bB-2BpIZsHUqftJ0keDo2WLmyAoTmz7FpTilAm5fcamqSCj-2BJvwNDrZtwak0hll2AI7jDvGC4-2FE1wHHDTw9DN



More information about the LibreOffice mailing list