New Defects reported by Coverity Scan for LibreOffice

scan-admin at coverity.com scan-admin at coverity.com
Thu Jul 4 20:20:37 UTC 2024


Hi,

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

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


** CID 1609598:    (COPY_INSTEAD_OF_MOVE)
/sd/source/ui/view/OutlinerIterator.cxx: 174 in sd::outliner::OutlinerContainer::CreateIterator(sd::outliner::IteratorLocation)()
/sd/source/ui/view/OutlinerIterator.cxx: 166 in sd::outliner::OutlinerContainer::CreateIterator(sd::outliner::IteratorLocation)()


________________________________________________________________________________________________________
*** CID 1609598:    (COPY_INSTEAD_OF_MOVE)
/sd/source/ui/view/OutlinerIterator.cxx: 174 in sd::outliner::OutlinerContainer::CreateIterator(sd::outliner::IteratorLocation)()
168                 mpOutliner->mbDirectionIsForward,
169                 aLocation);
170         else
171             // Search in the whole document.
172             return CreateDocumentIterator (
173                 mpOutliner->mpDrawDocument,
>>>     CID 1609598:    (COPY_INSTEAD_OF_MOVE)
>>>     "pOverridingShell" is copied in call to copy constructor "std::shared_ptr<sd::ViewShell>", when it could be moved instead.
174                 pOverridingShell ? pOverridingShell :
175                 mpOutliner->mpWeakViewShell.lock(),
176                 mpOutliner->mbDirectionIsForward,
177                 aLocation);
178     }
179     
/sd/source/ui/view/OutlinerIterator.cxx: 166 in sd::outliner::OutlinerContainer::CreateIterator(sd::outliner::IteratorLocation)()
160         // use.
161         if (mpOutliner->mbRestrictSearchToSelection)
162             // There is a selection.  Search only in this.
163             return CreateSelectionIterator (
164                 mpOutliner->maMarkListCopy,
165                 mpOutliner->mpDrawDocument,
>>>     CID 1609598:    (COPY_INSTEAD_OF_MOVE)
>>>     "pOverridingShell" is copied in call to copy constructor "std::shared_ptr<sd::ViewShell>", when it could be moved instead.
166                 pOverridingShell ? pOverridingShell :
167                 mpOutliner->mpWeakViewShell.lock(),
168                 mpOutliner->mbDirectionIsForward,
169                 aLocation);
170         else
171             // Search in the whole document.

** CID 1609597:  API usage errors  (INVALIDATE_ITERATOR)
/svl/source/items/globalpool.cxx: 353 in implCreateItemEntry(SfxItemPool &, const SfxPoolItem *, bool)()


________________________________________________________________________________________________________
*** CID 1609597:  API usage errors  (INVALIDATE_ITERATOR)
/svl/source/items/globalpool.cxx: 353 in implCreateItemEntry(SfxItemPool &, const SfxPoolItem *, bool)()
347                 if (pSource->isHashable())
348                     gInstanceManagerMap.insert(
349                         { aManagerKey, std::make_unique<HashableItemInstanceManager>() });
350                 else
351                     gInstanceManagerMap.insert(
352                         { aManagerKey, std::make_unique<DefaultItemInstanceManager>() });
>>>     CID 1609597:  API usage errors  (INVALIDATE_ITERATOR)
>>>     Dereferencing iterator "gInstanceManagerMap.find(aManagerKey)" though it is already past the end of its container.
353                 pManager = gInstanceManagerMap.find(aManagerKey)->second.get();
354             }
355     
356             bool bSuccess = pManager->add(*pSource);
357             assert(bSuccess && "failed to add item to pool");
358             (void)bSuccess;

** CID 1609596:  Integer handling issues  (SIGN_EXTENSION)
/svl/source/items/globalpool.cxx: 180 in <unnamed>::PairHash::operator ()(const std::pair<SfxItemType, unsigned short> &) const()


________________________________________________________________________________________________________
*** CID 1609596:  Integer handling issues  (SIGN_EXTENSION)
/svl/source/items/globalpool.cxx: 180 in <unnamed>::PairHash::operator ()(const std::pair<SfxItemType, unsigned short> &) const()
174     };
175     
176     struct PairHash
177     {
178         size_t operator()(const std::pair<SfxItemType, sal_uInt16>& rKey) const
179         {
>>>     CID 1609596:  Integer handling issues  (SIGN_EXTENSION)
>>>     Suspicious implicit sign extension: "rKey.first" with type "SfxItemType" (16 bits, unsigned) is promoted in "(static_cast<int>(rKey.first) << 16) | rKey.second" to type "int" (32 bits, signed), then sign-extended to type "unsigned long" (64 bits, unsigned).  If "(static_cast<int>(rKey.first) << 16) | rKey.second" is greater than 0x7FFFFFFF, the upper bits of the result will all be 1.
180             return (static_cast<int>(rKey.first) << 16) | rKey.second;
181         }
182     };
183     }
184     // The single static instance that takes over that global Item sharing
185     // Maps SfxItemPool sub-classes to a set of shared items.

** CID 1609595:  Null pointer dereferences  (NULL_RETURNS)
/sd/source/ui/view/Outliner.cxx: 1851 in SdOutliner::SetObject(const sd::outliner::IteratorPosition &)()


________________________________________________________________________________________________________
*** CID 1609595:  Null pointer dereferences  (NULL_RETURNS)
/sd/source/ui/view/Outliner.cxx: 1851 in SdOutliner::SetObject(const sd::outliner::IteratorPosition &)()
1845         if(rPosition.meEditMode == EditMode::Page && rPosition.mePageKind == PageKind::Notes)
1846         {
1847             std::shared_ptr<sd::ViewShell> pViewShell (mpWeakViewShell.lock());
1848             std::shared_ptr<sd::DrawViewShell> pDrawViewShell(
1849                 std::dynamic_pointer_cast<sd::DrawViewShell>(pViewShell));
1850     
>>>     CID 1609595:  Null pointer dereferences  (NULL_RETURNS)
>>>     Attempting to access the managed object of an empty smart pointer "pDrawViewShell".
1851             if (pDrawViewShell->GetEditMode() != EditMode::Page
1852                 || pDrawViewShell->GetCurPagePos() != rPosition.mnPageIndex)
1853                 SetPage(EditMode::Page, static_cast<sal_uInt16>(rPosition.mnPageIndex));
1854     
1855             mnText = rPosition.mnText;
1856             return rPosition.mxObject.get().get();

** CID 1609594:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/sd/source/filter/eppt/pptx-epptooxml.cxx: 1061 in oox::core::PowerPointExport::GetAuthorIdAndLastIndex(const rtl::OUString &, const rtl::OUString &, int &)()


________________________________________________________________________________________________________
*** CID 1609594:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
/sd/source/filter/eppt/pptx-epptooxml.cxx: 1061 in oox::core::PowerPointExport::GetAuthorIdAndLastIndex(const rtl::OUString &, const rtl::OUString &, int &)()
1055             struct AuthorComments aAuthorComments;
1056     
1057             aAuthorComments.nId = maAuthors.size();
1058             aAuthorComments.nLastIndex = 0;
1059             aAuthorComments.sInitials = sInitials;
1060     
>>>     CID 1609594:  Performance inefficiencies  (COPY_INSTEAD_OF_MOVE)
>>>     "aAuthorComments" is copied in a call to copy assignment "operator =", when it could be moved instead.
1061             maAuthors[ sAuthor ] = aAuthorComments;
1062         }
1063     
1064         nLastIndex = ++maAuthors[ sAuthor ].nLastIndex;
1065     
1066         return maAuthors[ sAuthor ].nId;


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://u15810271.ct.sendgrid.net/ls/click?upn=u001.AxU2LYlgjL6eX23u9ErQy-2BKADyCpvUKOL6EWmZljiu6VvXBlQRUbS683tC8265rGNPXqJ1ffcoLZCnTuJFQbNcTEkb4XaEQkzovKhJ5DB3c-3DSX-E_A9M4dSy7guk8NP6DcfgslOyvJRzavztVIKj6nRqYjYpWom7SJFyX0y710bz0kUGtf4BmAahZKpl2xGtWFs-2FvRaTmdMuif7-2FHMTD8SumQKl51oBpOIfoUbIWFQpIQOAEBdLRUREalU4CkvP5-2FBv6W9Ck-2Fg1hsf-2BmbYZkJN-2FFrtBAWjDHVuEUDgn-2FnEo-2BBrGtZM0u6A3Kt-2BkEYPtgYsmsrvBmU8THbmrLOSzs77mFT9e4-3D



More information about the LibreOffice mailing list