Hi,

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

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


** CID 1636583:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/sd/source/ui/sidebar/MasterPagesSelector.cxx: 338 in 
sd::sidebar::MasterPagesSelector::NotifyContainerChangeEvent(const 
sd::sidebar::MasterPageContainerChangeEvent &)()


________________________________________________________________________________________________________
*** CID 1636583:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/sd/source/ui/sidebar/MasterPagesSelector.cxx: 338 in 
sd::sidebar::MasterPagesSelector::NotifyContainerChangeEvent(const 
sd::sidebar::MasterPageContainerChangeEvent &)()
332                 int nIndex (GetIndexForToken(rEvent.maChildToken));
333                 if (nIndex >= 0)
334                 {
335                     Image 
aPreview(mpContainer->GetPreviewForToken(rEvent.maChildToken));
336                     if (aPreview.GetSizePixel().Width() > 0)
337                     {
>>>     CID 1636583:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
>>>     "aPreview" is passed-by-value as parameter to "GetVirtualDevice" when 
>>> it could be moved instead.
338                         VclPtr<VirtualDevice> aDev = 
GetVirtualDevice(aPreview);
339                         mxPreviewIconView->set_image(nIndex, aDev);
340                     }
341                 }
342             }
343             break;

** CID 1636582:  Program hangs  (NEGATIVE_RETURNS)
/sd/source/ui/view/DocumentRenderer.cxx: 925 in 
sd::<unnamed>::NotesPrinterPage::Print(Printer &, SdDrawDocument &, 
sd::ViewShell &, sd::View *, sd::DrawView &, const SdrLayerIDSet &, const 
SdrLayerIDSet &) const()


________________________________________________________________________________________________________
*** CID 1636582:  Program hangs  (NEGATIVE_RETURNS)
/sd/source/ui/view/DocumentRenderer.cxx: 925 in 
sd::<unnamed>::NotesPrinterPage::Print(Printer &, SdDrawDocument &, 
sd::ViewShell &, sd::View *, sd::DrawView &, const SdrLayerIDSet &, const 
SdrLayerIDSet &) const()
919                         std::vector<std::pair<sal_Int32, sal_Int32>> 
aPageBreaks;
920     
921                         for (sal_Int32 i = 0; i < nParaCount && !bExit; ++i)
922                         {
923                             sal_Int32 nActualLineLen = 0;
924                             sal_uInt32 nLineCount = pOut->GetLineCount(i);
>>>     CID 1636582:  Program hangs  (NEGATIVE_RETURNS)
>>>     Using unsigned variable "nLineCount" in a loop exit condition.
925                             for (sal_uInt32 j = 0; j < nLineCount; ++j)
926                             {
927                                 nActualLineLen += pOut->GetLineLen(i, j);
928                                 sal_Int32 nLineHeight = 
pOut->GetLineHeight(i, j);
929                                 sal_Int32 nNextPosY = nCurrentPosY + 
nLineHeight;
930     

** CID 1636581:  Null pointer dereferences  (FORWARD_NULL)


________________________________________________________________________________________________________
*** CID 1636581:  Null pointer dereferences  (FORWARD_NULL)
/sw/source/core/unocore/unostyle.cxx: 1080 in 
SwXStyleFamily::insertByName(const rtl::OUString &, const 
com::sun::star::uno::Any &)()
1074         {
1075             uno::Reference<lang::XUnoTunnel> xStyleTunnel = 
rElement.get<uno::Reference<lang::XUnoTunnel>>();
1076             SwXStyle* pNewStyle = 
comphelper::getFromUnoTunnel<SwXStyle>(xStyleTunnel);
1077             if (!pNewStyle)
1078                 throw lang::IllegalArgumentException();
1079     
>>>     CID 1636581:  Null pointer dereferences  (FORWARD_NULL)
>>>     "insertStyleByNameImpl" dereferences null "this->m_pDocShell".
1080             insertStyleByNameImpl(pNewStyle, sStyleName);
1081         }
1082     }
1083     
1084     void SwXStyleFamily::insertStyleByNameImpl(const 
rtl::Reference<SwXStyle>& pNewStyle, const OUString& sStyleName)
1085     {

** CID 1636580:    (FORWARD_NULL)


________________________________________________________________________________________________________
*** CID 1636580:    (FORWARD_NULL)
/sw/source/core/unocore/unostyle.cxx: 977 in 
SwXStyleFamily::getStyleByName(const rtl::OUString &)()
971                 case SfxStyleFamily::Char:
972                 case SfxStyleFamily::Para:
973                 case SfxStyleFamily::Pseudo:
974                     xStyle = ::CreateStyleCharOrParaOrPseudo(m_pBasePool, 
m_pDocShell, sStyleName, m_rEntry.family());
975                     break;
976                 case SfxStyleFamily::Page:
>>>     CID 1636580:    (FORWARD_NULL)
>>>     Passing null pointer "this->m_pDocShell" to "CreateStylePage", which 
>>> dereferences it.
977                     xStyle = ::CreateStylePage(m_pBasePool, m_pDocShell, 
sStyleName);
978                     break;
979                 case SfxStyleFamily::Frame:
980                     xStyle = ::CreateStyleFrame(m_pBasePool, m_pDocShell, 
pBase->GetName());
981                     break;
982                 case SfxStyleFamily::Table:
/sw/source/core/unocore/unostyle.cxx: 980 in 
SwXStyleFamily::getStyleByName(const rtl::OUString &)()
974                     xStyle = ::CreateStyleCharOrParaOrPseudo(m_pBasePool, 
m_pDocShell, sStyleName, m_rEntry.family());
975                     break;
976                 case SfxStyleFamily::Page:
977                     xStyle = ::CreateStylePage(m_pBasePool, m_pDocShell, 
sStyleName);
978                     break;
979                 case SfxStyleFamily::Frame:
>>>     CID 1636580:    (FORWARD_NULL)
>>>     Passing null pointer "this->m_pDocShell" to "CreateStyleFrame", which 
>>> dereferences it.
980                     xStyle = ::CreateStyleFrame(m_pBasePool, m_pDocShell, 
pBase->GetName());
981                     break;
982                 case SfxStyleFamily::Table:
983                     xStyle = ::CreateStyleTable(m_pDocShell, sStyleName);
984                     break;
985                 case SfxStyleFamily::Cell:
/sw/source/core/unocore/unostyle.cxx: 983 in 
SwXStyleFamily::getStyleByName(const rtl::OUString &)()
977                     xStyle = ::CreateStylePage(m_pBasePool, m_pDocShell, 
sStyleName);
978                     break;
979                 case SfxStyleFamily::Frame:
980                     xStyle = ::CreateStyleFrame(m_pBasePool, m_pDocShell, 
pBase->GetName());
981                     break;
982                 case SfxStyleFamily::Table:
>>>     CID 1636580:    (FORWARD_NULL)
>>>     Passing null pointer "this->m_pDocShell" to "CreateStyleTable", which 
>>> dereferences it.
983                     xStyle = ::CreateStyleTable(m_pDocShell, sStyleName);
984                     break;
985                 case SfxStyleFamily::Cell:
986                     xStyle = ::CreateStyleCell(m_pDocShell, sStyleName);
987                     break;
988                 default:
/sw/source/core/unocore/unostyle.cxx: 986 in 
SwXStyleFamily::getStyleByName(const rtl::OUString &)()
980                     xStyle = ::CreateStyleFrame(m_pBasePool, m_pDocShell, 
pBase->GetName());
981                     break;
982                 case SfxStyleFamily::Table:
983                     xStyle = ::CreateStyleTable(m_pDocShell, sStyleName);
984                     break;
985                 case SfxStyleFamily::Cell:
>>>     CID 1636580:    (FORWARD_NULL)
>>>     Passing null pointer "this->m_pDocShell" to "CreateStyleCell", which 
>>> dereferences it.
986                     xStyle = ::CreateStyleCell(m_pDocShell, sStyleName);
987                     break;
988                 default:
989                     assert(false);
990             }
991         return xStyle;
/sw/source/core/unocore/unostyle.cxx: 974 in 
SwXStyleFamily::getStyleByName(const rtl::OUString &)()
968         if(!xStyle.is())
969             switch (m_rEntry.family())
970             {
971                 case SfxStyleFamily::Char:
972                 case SfxStyleFamily::Para:
973                 case SfxStyleFamily::Pseudo:
>>>     CID 1636580:    (FORWARD_NULL)
>>>     Passing null pointer "this->m_pDocShell" to 
>>> "CreateStyleCharOrParaOrPseudo", which dereferences it.
974                     xStyle = ::CreateStyleCharOrParaOrPseudo(m_pBasePool, 
m_pDocShell, sStyleName, m_rEntry.family());
975                     break;
976                 case SfxStyleFamily::Page:
977                     xStyle = ::CreateStylePage(m_pBasePool, m_pDocShell, 
sStyleName);
978                     break;
979                 case SfxStyleFamily::Frame:

** CID 1636579:  Null pointer dereferences  (FORWARD_NULL)


________________________________________________________________________________________________________
*** CID 1636579:  Null pointer dereferences  (FORWARD_NULL)
/sw/source/core/unocore/unostyle.cxx: 1033 in 
SwXStyleFamily::insertStyleByName(const rtl::OUString &, const 
rtl::Reference<SwXStyle> &)()
1027         OUString sStyleName;
1028         SwStyleNameMapper::FillUIName(rName, sStyleName, m_rEntry.poolId(),
1029                 m_pDocShell && 
!m_pDocShell->GetDoc()->IsInWriterfilterImport());
1030         SfxStyleSheetBase* pBase = m_pBasePool->Find(sStyleName, 
m_rEntry.family());
1031         if (pBase)
1032             throw container::ElementExistException();
>>>     CID 1636579:  Null pointer dereferences  (FORWARD_NULL)
>>>     "insertStyleByNameImpl" dereferences null "this->m_pDocShell".
1033         insertStyleByNameImpl(pNewStyle, sStyleName);
1034     }
1035     
1036     void SwXStyleFamily::insertByName(const OUString& rName, const 
uno::Any& rElement)
1037     {
1038         SolarMutexGuard aGuard;

** CID 1636578:  Error handling issues  (CHECKED_RETURN)
/vcl/jsdialog/executor.cxx: 580 in jsdialog::ExecuteAction(const rtl::OUString 
&, const rtl::OUString &, std::map<rtl::OUString, rtl::OUString, 
std::less<rtl::OUString>, std::allocator<std::pair<const rtl::OUString, 
rtl::OUString>>> &)()


________________________________________________________________________________________________________
*** CID 1636578:  Error handling issues  (CHECKED_RETURN)
/vcl/jsdialog/executor.cxx: 580 in jsdialog::ExecuteAction(const rtl::OUString 
&, const rtl::OUString &, std::map<rtl::OUString, rtl::OUString, 
std::less<rtl::OUString>, std::allocator<std::pair<const rtl::OUString, 
rtl::OUString>>> &)()
574                     }
575                     else if (sAction == "contextmenu")
576                     {
577                         sal_Int32 nEntryAbsPos = 
o3tl::toInt32(rData["data"]);
578     
579                         std::unique_ptr<weld::TreeIter> 
itEntry(pTreeView->make_iterator());
>>>     CID 1636578:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "get_iter_abs_pos" without checking return value (as is done 
>>> elsewhere 4 out of 5 times).
580                         pTreeView->get_iter_abs_pos(*itEntry, nEntryAbsPos);
581     
582                         tools::Rectangle aRect = 
pTreeView->get_row_area(*itEntry);
583                         CommandEvent aCommand(aRect.Center(), 
CommandEventId::ContextMenu);
584     
585                         LOKTrigger::trigger_popup_menu(*pTreeView, 
aCommand);

** CID 1636577:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/sd/source/ui/sidebar/MasterPagesSelector.cxx: 496 in 
sd::sidebar::MasterPagesSelector::UpdateAllPreviews()()


________________________________________________________________________________________________________
*** CID 1636577:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/sd/source/ui/sidebar/MasterPagesSelector.cxx: 496 in 
sd::sidebar::MasterPagesSelector::UpdateAllPreviews()()
490             const MasterPageContainer::Token aToken
491                 = 
static_cast<MasterPageContainer::Token>(mxPreviewIconView->get_id(aIndex).toInt32());
492     
493             Image aPreview(mpContainer->GetPreviewForToken(aToken));
494             if (aPreview.GetSizePixel().Width() > 0)
495             {
>>>     CID 1636577:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
>>>     "aPreview" is passed-by-value as parameter to "GetVirtualDevice" when 
>>> it could be moved instead.
496                 VclPtr<VirtualDevice> pVDev = GetVirtualDevice(aPreview);
497                 mxPreviewIconView->set_image(aIndex, pVDev);
498             }
499             else if (mpContainer->GetPreviewState(aToken) == 
MasterPageContainer::PS_CREATABLE)
500             {
501                 mpContainer->RequestPreview(aToken);

** CID 1636576:  Null pointer dereferences  (NULL_RETURNS)
/sd/source/ui/view/DocumentRenderer.cxx: 2464 in 
sd::DocumentRenderer::Implementation::PrepareScaledPage(int, const SdPage &, 
PageKind, const sd::<unnamed>::PrintInfo &)()


________________________________________________________________________________________________________
*** CID 1636576:  Null pointer dereferences  (NULL_RETURNS)
/sd/source/ui/view/DocumentRenderer.cxx: 2464 in 
sd::DocumentRenderer::Implementation::PrepareScaledPage(int, const SdPage &, 
PageKind, const sd::<unnamed>::PrintInfo &)()
2458                 {
2459                     SdPage* pPage = GetFilteredPage(nPageIndex, 
PageKind::Notes);
2460                     SdDrawDocument* pDocument = 
mrBase.GetMainViewShell()->GetDoc();
2461     
2462                     // Clone the current page to create an independent 
instance.
2463                     // This ensures that changes made to pNotesPage do not 
affect the original page.
>>>     CID 1636576:  Null pointer dereferences  (NULL_RETURNS)
>>>     Dereferencing a pointer that might be "nullptr" "pPage" when calling 
>>> "CloneSdrPage". (The dereference happens because this is a virtual function 
>>> call.)
2464                     rtl::Reference<SdPage> pNotesPage
2465                         = 
static_cast<SdPage*>(pPage->CloneSdrPage(*pDocument).get());
2466     
2467                     Size aPageSize = bScalePage ? pNotesPage->GetSize() : 
rInfo.mpPrinter->GetPrintPageSize();
2468                     // Adjusts the objects on the notes page to fit the 
new page size.
2469                     ::tools::Rectangle aNewBorderRect(-1, -1, -1, -1);

** CID 1636575:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/sd/source/ui/sidebar/MasterPagesSelector.cxx: 395 in 
sd::sidebar::MasterPagesSelector::SetItem(unsigned short, int)()


________________________________________________________________________________________________________
*** CID 1636575:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/sd/source/ui/sidebar/MasterPagesSelector.cxx: 395 in 
sd::sidebar::MasterPagesSelector::SetItem(unsigned short, int)()
389         {
390             Image aPreview (mpContainer->GetPreviewForToken(aToken));
391             MasterPageContainer::PreviewState eState 
(mpContainer->GetPreviewState(aToken));
392     
393             if (aPreview.GetSizePixel().Width() > 0)
394             {
>>>     CID 1636575:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
>>>     "aPreview" is passed-by-value as parameter to "GetVirtualDevice" when 
>>> it could be moved instead.
395                 VclPtr<VirtualDevice> aVDev = GetVirtualDevice(aPreview);
396                 if (!mxPreviewIconView->get_id(nIndex).isEmpty())
397                 {
398                     mxPreviewIconView->set_image(nIndex, aVDev);
399                     mxPreviewIconView->set_id(nIndex, 
OUString::number(aToken));
400                 }


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, 
https://u15810271.ct.sendgrid.net/ls/click?upn=u001.AxU2LYlgjL6eX23u9ErQy-2BKADyCpvUKOL6EWmZljiu6VvXBlQRUbS683tC8265rGNPXqJ1ffcoLZCnTuJFQbNcTEkb4XaEQkzovKhJ5DB3c-3D6aH__A9M4dSy7guk8NP6DcfgslOyvJRzavztVIKj6nRqYjYpWom7SJFyX0y710bz0kUGtJF9pDcP2iFT6CcTLNQ8u-2Fs-2FVAegckvUfU5B8dllFNVp8voo3m-2FgMQK7gEr3ZNY3vsvnpnuJaJlMnygSNBjjRdgS3iZwueXVVo3WEBjPlwXIggHEXomOdhnwCJOjcKKdPMUINy8vh4QVRoDMAtdfuWY8GH3jXDZ1K89k0g9IY10Q-3D

Reply via email to