New Defects reported by Coverity Scan for LibreOffice

scan-admin at coverity.com scan-admin at coverity.com
Mon Dec 25 04:33:34 UTC 2023


Hi,

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

3 new defect(s) introduced to LibreOffice found with Coverity Scan.
74 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 3 of 3 defect(s)


** CID 1559939:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/svx/source/tbxctrls/PaletteManager.cxx: 409 in PaletteManager::PopupColorPicker(weld::Window *, const rtl::OUString &, const Color &)()


________________________________________________________________________________________________________
*** CID 1559939:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/svx/source/tbxctrls/PaletteManager.cxx: 409 in PaletteManager::PopupColorPicker(weld::Window *, const rtl::OUString &, const Color &)()
403         // The calling object goes away during aColorDlg.Execute(), so we must copy this
404         OUString aCommandCopy = aCommand;
405         m_pColorDlg = std::make_unique<SvColorDialog>();
406         m_pColorDlg->SetColor(rInitialColor);
407         m_pColorDlg->SetMode(svtools::ColorPickerMode::Modify);
408         std::shared_ptr<PaletteManager> xSelf(shared_from_this());
>>>     CID 1559939:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
>>>     "xSelf" is copied in call to copy constructor "std::shared_ptr<PaletteManager>", when it could be moved instead.
409         m_pColorDlg->ExecuteAsync(pParent, [xSelf, aCommandCopy] (sal_Int32 nResult) {
410             if (nResult == RET_OK)
411             {
412                 Color aLastColor = xSelf->m_pColorDlg->GetColor();
413                 OUString sColorName = "#" + aLastColor.AsRGBHexString().toAsciiUpperCase();
414                 NamedColor aNamedColor(aLastColor, sColorName);

** CID 1559938:  Null pointer dereferences  (NULL_RETURNS)


________________________________________________________________________________________________________
*** CID 1559938:  Null pointer dereferences  (NULL_RETURNS)
/sd/source/ui/dlg/LayerTabBar.cxx: 182 in sd::LayerTabBar::BringLayerObjectsToAttention(unsigned short)()
176                 SdrLayerAdmin& rLayerAdmin = pDrViewSh->GetDoc()->GetLayerAdmin();
177                 SdrObjListIter aIter(pDrViewSh->GetActualPage(), SdrIterMode::DeepWithGroups);
178                 while (aIter.IsMore())
179                 {
180                     SdrObject* pObj = aIter.Next();
181                     assert(pObj != nullptr);
>>>     CID 1559938:  Null pointer dereferences  (NULL_RETURNS)
>>>     Dereferencing a pointer that might be "nullptr" "rLayerAdmin->GetLayerPerID(pObj->GetLayer())->GetName()" when calling "operator ==".
182                     if (pObj && (aLayerName == rLayerAdmin.GetLayerPerID(pObj->GetLayer())->GetName()))
183                     {
184                         ::tools::Rectangle aRect(pObj->GetLogicRect());
185                         if (!aRect.IsEmpty())
186                             aRanges.emplace_back(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom());
187                         // skip over objects in groups

** CID 1559937:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/cui/source/dialogs/colorpicker.cxx: 1349 in cui::<unnamed>::ColorPicker::startExecuteModal(const com::sun::star::uno::Reference<com::sun::star::ui::dialogs::XDialogClosedListener> &)()


________________________________________________________________________________________________________
*** CID 1559937:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/cui/source/dialogs/colorpicker.cxx: 1349 in cui::<unnamed>::ColorPicker::startExecuteModal(const com::sun::star::uno::Reference<com::sun::star::ui::dialogs::XDialogClosedListener> &)()
1343     }
1344     
1345     void SAL_CALL ColorPicker::startExecuteModal( const css::uno::Reference< css::ui::dialogs::XDialogClosedListener >& xListener )
1346     {
1347         std::shared_ptr<ColorPickerDialog> xDlg = std::make_shared<ColorPickerDialog>(Application::GetFrameWeld(mxParent), mnColor, mnMode);
1348         rtl::Reference<ColorPicker> xThis(this);
>>>     CID 1559937:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
>>>     "xThis" is copied in call to copy constructor "rtl::Reference<cui::<unnamed>::ColorPicker>", when it could be moved instead.
1349         weld::DialogController::runAsync(xDlg, [xThis, xDlg, xListener] (sal_Int32 nResult) {
1350             if (nResult)
1351                 xThis->mnColor = xDlg->GetColor();
1352     
1353             sal_Int16 nRet = static_cast<sal_Int16>(nResult);
1354             css::ui::dialogs::DialogClosedEvent aEvent( *xThis, nRet );


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50ypSs1kiFPuCn2xFdlMIFBirii0zZ9j2-2F9F2XPBcBm2BNnPiSHxWPOELPnIxzXoBNaw-3DlVcR_OTq2XUZbbipYjyLSo6GRo-2FpVxQ9OzkDINu9UTS-2FQhSdO0F0jQniitrGlNxDIzPJiAleIz1OOTD8HuEQKQK0THk9I6rxelM25GK01hHVmv8r0qijbRzucdNDLbQjahnlPxHQrfGDlThnqbOCE4ng0VUNyRzYoMfA5bkJTpVO15dOKlEJhP8JIoKMxmwYERdiM0is3LrqSkmwjTJ4L-2BAH-2BnmAPYPM5q-2BrqNlcmlcy85fw-3D



More information about the LibreOffice mailing list