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.
14 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 1667147: Insecure data handling (INTEGER_OVERFLOW)
_____________________________________________________________________________________________
*** CID 1667147: Insecure data handling (INTEGER_OVERFLOW)
/desktop/source/deployment/gui/dp_gui_extlistbox.cxx: 445 in
dp_gui::ExtensionBox::DrawRow(OutputDevice &, const tools::Rectangle &, const
std::shared_ptr<dp_gui::Entry_Impl> &)()
439
440 rRenderContext.SetFont(aBoldFont);
441 tools::Long aTitleWidth =
rRenderContext.GetTextWidth(rEntry->m_sTitle) + (aTextHeight / 3);
442 if (aTitleWidth > nMaxTitleWidth - aVersionWidth)
443 {
444 aTitleWidth = nMaxTitleWidth - aVersionWidth - (aTextHeight /
3);
>>> CID 1667147: Insecure data handling (INTEGER_OVERFLOW)
>>> "aTitleWidth", which might have underflowed, is passed to
>>> "rRenderContext->GetEllipsisString(rEntry->m_sTitle, aTitleWidth,
>>> DrawTextFlags::EndEllipsis)".
445 OUString aShortTitle =
rRenderContext.GetEllipsisString(rEntry->m_sTitle, aTitleWidth);
446 rRenderContext.DrawText(aPos, aShortTitle);
447 aTitleWidth += (aTextHeight / 3);
448 }
449 else
450 rRenderContext.DrawText(aPos, rEntry->m_sTitle);
** CID 1667146: (COPY_INSTEAD_OF_MOVE)
/basctl/source/basicide/idedataprovider.cxx: 130 in
basctl::<unnamed>::ImplGetMembersOfUnoType(std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
std::allocator<std::shared_ptr<basctl::IdeSymbolInfo>>> &, const
basctl::IdeSymbolInfo &, std::unordered_set<rtl::OUString,
std::hash<rtl::OUString>, std::equal_to<rtl::OUString>,
std::allocator<rtl::OUString>> &, unsigned short)()
/basctl/source/basicide/idedataprovider.cxx: 162 in
basctl::<unnamed>::ImplGetMembersOfUnoType(std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
std::allocator<std::shared_ptr<basctl::IdeSymbolInfo>>> &, const
basctl::IdeSymbolInfo &, std::unordered_set<rtl::OUString,
std::hash<rtl::OUString>, std::equal_to<rtl::OUString>,
std::allocator<rtl::OUString>> &, unsigned short)()
_____________________________________________________________________________________________
*** CID 1667146: (COPY_INSTEAD_OF_MOVE)
/basctl/source/basicide/idedataprovider.cxx: 130 in
basctl::<unnamed>::ImplGetMembersOfUnoType(std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
std::allocator<std::shared_ptr<basctl::IdeSymbolInfo>>> &, const
basctl::IdeSymbolInfo &, std::unordered_set<rtl::OUString,
std::hash<rtl::OUString>, std::equal_to<rtl::OUString>,
std::allocator<rtl::OUString>> &, unsigned short)()
124 {
125 for (const auto& xInterface : xTypeClass->getInterfaces())
126 {
127 auto pNode = std::make_shared<IdeSymbolInfo>(
128 xInterface->getName(),
IdeSymbolKind::UNO_INTERFACE, rNode.sIdentifier);
129 pNode->sQualifiedName = xInterface->getName();
>>> CID 1667146: (COPY_INSTEAD_OF_MOVE)
>>> "pNode" is copied and then passed-by-reference as parameter to STL
>>> insertion function "std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
>>> std::allocator<std::shared_ptr<basctl::IdeSymbolInfo> >
>>> >::push_back(std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
>>> std::allocator<std::shared_ptr<basctl::IdeSymbolInfo> > >::value_type const
>>> &)", when it could be moved instead.
130 rMembers.push_back(pNode);
131 }
132 return;
133 }
134
135 for (const auto& xMethod : xTypeClass->getMethods())
/basctl/source/basicide/idedataprovider.cxx: 162 in
basctl::<unnamed>::ImplGetMembersOfUnoType(std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
std::allocator<std::shared_ptr<basctl::IdeSymbolInfo>>> &, const
basctl::IdeSymbolInfo &, std::unordered_set<rtl::OUString,
std::hash<rtl::OUString>, std::equal_to<rtl::OUString>,
std::allocator<rtl::OUString>> &, unsigned short)()
156 || rParam.aMode ==
css::reflection::ParamMode_INOUT);
157 aParam.bIsOut = (rParam.aMode ==
css::reflection::ParamMode_OUT
158 || rParam.aMode ==
css::reflection::ParamMode_INOUT);
159 pNode->aParameters.push_back(std::move(aParam));
160 }
161
>>> CID 1667146: (COPY_INSTEAD_OF_MOVE)
>>> "pNode" is copied and then passed-by-reference as parameter to STL
>>> insertion function "std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
>>> std::allocator<std::shared_ptr<basctl::IdeSymbolInfo> >
>>> >::push_back(std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
>>> std::allocator<std::shared_ptr<basctl::IdeSymbolInfo> > >::value_type const
>>> &)", when it could be moved instead.
162 rMembers.push_back(pNode);
163 }
164
165 for (const auto& xField : xTypeClass->getFields())
166 {
167 if (!xField.is())
** CID 1667145: (COPY_INSTEAD_OF_MOVE)
/basctl/source/basicide/idedataprovider.cxx: 347 in
basctl::<unnamed>::ImplGetChildrenOfBasicLibrary(std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
std::allocator<std::shared_ptr<basctl::IdeSymbolInfo>>> &, const
basctl::IdeSymbolInfo &)()
/basctl/source/basicide/idedataprovider.cxx: 328 in
basctl::<unnamed>::ImplGetChildrenOfBasicLibrary(std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
std::allocator<std::shared_ptr<basctl::IdeSymbolInfo>>> &, const
basctl::IdeSymbolInfo &)()
_____________________________________________________________________________________________
*** CID 1667145: (COPY_INSTEAD_OF_MOVE)
/basctl/source/basicide/idedataprovider.cxx: 347 in
basctl::<unnamed>::ImplGetChildrenOfBasicLibrary(std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
std::allocator<std::shared_ptr<basctl::IdeSymbolInfo>>> &, const
basctl::IdeSymbolInfo &)()
341 auto pNode = std::make_shared<IdeSymbolInfo>(
342 pModule->GetName(), IdeSymbolKind::MODULE,
rParent.sIdentifier);
343 pNode->sOriginLocation = rParent.sOriginLocation;
344 pNode->sOriginLibrary = rParent.sName;
345 pNode->sParentName = rParent.sName;
346 pNode->sIdentifier = rParent.sIdentifier + u":" +
pNode->sName;
>>> CID 1667145: (COPY_INSTEAD_OF_MOVE)
>>> "pNode" is copied and then passed-by-reference as parameter to STL
>>> insertion function "std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
>>> std::allocator<std::shared_ptr<basctl::IdeSymbolInfo> >
>>> >::push_back(std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
>>> std::allocator<std::shared_ptr<basctl::IdeSymbolInfo> > >::value_type const
>>> &)", when it could be moved instead.
347 rChildren.push_back(pNode);
348 }
349 }
350 }
351 }
352 }
/basctl/source/basicide/idedataprovider.cxx: 328 in
basctl::<unnamed>::ImplGetChildrenOfBasicLibrary(std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
std::allocator<std::shared_ptr<basctl::IdeSymbolInfo>>> &, const
basctl::IdeSymbolInfo &)()
322 if (aDoc.isDocument())
323 {
324 pNode->sOriginLocation = aDoc.getDocument()->getURL();
325 }
326 pNode->sParentName = rParent.sName;
327 pNode->sIdentifier = rParent.sIdentifier + u":" + rLibName;
>>> CID 1667145: (COPY_INSTEAD_OF_MOVE)
>>> "pNode" is copied and then passed-by-reference as parameter to STL
>>> insertion function "std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
>>> std::allocator<std::shared_ptr<basctl::IdeSymbolInfo> >
>>> >::push_back(std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
>>> std::allocator<std::shared_ptr<basctl::IdeSymbolInfo> > >::value_type const
>>> &)", when it could be moved instead.
328 rChildren.push_back(pNode);
329 }
330 }
331 else if (rParent.eKind == IdeSymbolKind::LIBRARY)
332 {
333 BasicManager* pBasMgr = aDoc.getBasicManager();
** CID 1667144: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/basctl/source/basicide/idedataprovider.cxx: 298 in
basctl::<unnamed>::ImplGetMembersOfBasicModule(std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
std::allocator<std::shared_ptr<basctl::IdeSymbolInfo>>> &, const
basctl::IdeSymbolInfo &)()
_____________________________________________________________________________________________
*** CID 1667144: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/basctl/source/basicide/idedataprovider.cxx: 298 in
basctl::<unnamed>::ImplGetMembersOfBasicModule(std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
std::allocator<std::shared_ptr<basctl::IdeSymbolInfo>>> &, const
basctl::IdeSymbolInfo &)()
292 pMember->aParameters.push_back(aParam);
293
294 pParamInfo = pInfo->GetParam(++j);
295 }
296 }
297
>>> CID 1667144: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
>>> "pMember" is copied and then passed-by-reference as parameter to STL
>>> insertion function "std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
>>> std::allocator<std::shared_ptr<basctl::IdeSymbolInfo> >
>>> >::push_back(std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
>>> std::allocator<std::shared_ptr<basctl::IdeSymbolInfo> > >::value_type const
>>> &)", when it could be moved instead.
298 rMembers.push_back(pMember);
299 }
300 }
301 }
302 }
303
** CID 1667143: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/basctl/source/basicide/idedataprovider.cxx: 216 in
basctl::<unnamed>::ImplGetMembersOfUnoType(std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
std::allocator<std::shared_ptr<basctl::IdeSymbolInfo>>> &, const
basctl::IdeSymbolInfo &, std::unordered_set<rtl::OUString,
std::hash<rtl::OUString>, std::equal_to<rtl::OUString>,
std::allocator<rtl::OUString>> &, unsigned short)()
_____________________________________________________________________________________________
*** CID 1667143: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/basctl/source/basicide/idedataprovider.cxx: 216 in
basctl::<unnamed>::ImplGetMembersOfUnoType(std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
std::allocator<std::shared_ptr<basctl::IdeSymbolInfo>>> &, const
basctl::IdeSymbolInfo &, std::unordered_set<rtl::OUString,
std::hash<rtl::OUString>, std::equal_to<rtl::OUString>,
std::allocator<rtl::OUString>> &, unsigned short)()
210 {
211 pMember->mapMembers[pNested->sName] = pNested;
212 }
213 }
214 }
215
>>> CID 1667143: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
>>> "pMember" is copied and then passed-by-reference as parameter to STL
>>> insertion function "std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
>>> std::allocator<std::shared_ptr<basctl::IdeSymbolInfo> >
>>> >::push_back(std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
>>> std::allocator<std::shared_ptr<basctl::IdeSymbolInfo> > >::value_type const
>>> &)", when it could be moved instead.
216 rMembers.push_back(pMember);
217 }
218 }
219 catch (const Exception& e)
220 {
221 SAL_WARN("basctl", "Exception while getting members of UNO
type: " << e.Message);
** CID 1667142: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/basctl/source/basicide/idedataprovider.cxx: 583 in
basctl::IdeDataProvider::GetTopLevelNodes()()
_____________________________________________________________________________________________
*** CID 1667142: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/basctl/source/basicide/idedataprovider.cxx: 583 in
basctl::IdeDataProvider::GetTopLevelNodes()()
577 if (!m_bInitialized)
578 {
579 SymbolInfoList aNodes;
580 auto pLoadingNode =
std::make_shared<IdeSymbolInfo>(u"[Initializing...]",
581
IdeSymbolKind::PLACEHOLDER, u"");
582 pLoadingNode->bSelectable = false;
>>> CID 1667142: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
>>> "pLoadingNode" is copied and then passed-by-reference as parameter to
>>> STL insertion function "std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
>>> std::allocator<std::shared_ptr<basctl::IdeSymbolInfo> >
>>> >::push_back(std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
>>> std::allocator<std::shared_ptr<basctl::IdeSymbolInfo> > >::value_type const
>>> &)", when it could be moved instead.
583 aNodes.push_back(pLoadingNode);
584 return aNodes;
585 }
586
587 SymbolInfoList aFilteredNodes;
588 for (const auto& pNode : m_aAllTopLevelNodes)
** CID 1667141: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
_____________________________________________________________________________________________
*** CID 1667141: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/basctl/source/basicide/objectbrowser.cxx: 1057 in
basctl::ObjectBrowser::NavigateToMacroSource(const basctl::IdeSymbolInfo &)()
1051 if (aDoc.isAlive())
1052 {
1053 SAL_INFO("basctl",
1054 "NavigateToMacroSource: Document is alive,
dispatching SID_BASICIDE_SHOWSBX.");
1055
1056 // Pass the method name so it navigates to the exact line
>>> CID 1667141: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
>>> "aDoc" is passed-by-value as parameter to
>>> "basctl::ScriptDocument::ScriptDocument(basctl::ScriptDocument const &)
>>> /*implicit =default*/", when it could be moved instead.
1057 SbxItem aSbxItem(SID_BASICIDE_ARG_SBX, aDoc,
rSymbol.sOriginLibrary, rSymbol.sOriginModule,
1058 rSymbol.sName, basctl::SBX_TYPE_METHOD);
1059
1060 SfxViewFrame& rViewFrame = m_pShell->GetViewFrame();
1061 if (SfxDispatcher* pDispatcher = rViewFrame.GetDispatcher())
1062 {
** CID 1667140: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/basctl/source/basicide/idedataprovider.cxx: 550 in
basctl::IdeDataProvider::AddDocumentNodesWithModules()()
_____________________________________________________________________________________________
*** CID 1667140: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/basctl/source/basicide/idedataprovider.cxx: 550 in
basctl::IdeDataProvider::AddDocumentNodesWithModules()()
544 auto pDocNode = std::make_shared<IdeSymbolInfo>(
545 rDoc.getTitle(), IdeSymbolKind::ROOT_DOCUMENT_LIBS,
u"root");
546 if (rDoc.isDocument() && rDoc.getDocument().is())
547 {
548 pDocNode->sOriginLocation =
rDoc.getDocument()->getURL();
549 }
>>> CID 1667140: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
>>> "pDocNode" is copied and then passed-by-reference as parameter to STL
>>> insertion function "std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
>>> std::allocator<std::shared_ptr<basctl::IdeSymbolInfo> >
>>> >::push_back(std::vector<std::shared_ptr<basctl::IdeSymbolInfo>,
>>> std::allocator<std::shared_ptr<basctl::IdeSymbolInfo> > >::value_type const
>>> &)", when it could be moved instead.
550 m_aAllTopLevelNodes.push_back(pDocNode);
551 }
552 }
553 }
554 }
555
** CID 1667139: Error handling issues (CHECKED_RETURN)
/basctl/source/basicide/objectbrowser.cxx: 1179 in
basctl::ObjectBrowser::OnRightTreeSelect(weld::TreeView &)()
_____________________________________________________________________________________________
*** CID 1667139: Error handling issues (CHECKED_RETURN)
/basctl/source/basicide/objectbrowser.cxx: 1179 in
basctl::ObjectBrowser::OnRightTreeSelect(weld::TreeView &)()
1173 if (m_bDisposed)
1174 {
1175 return;
1176 }
1177
1178 auto xLeftIter = m_xLeftTreeView->make_iterator();
>>> CID 1667139: Error handling issues (CHECKED_RETURN)
>>> Calling "get_selected" without checking return value (as is done
>>> elsewhere 129 out of 146 times).
1179 m_xLeftTreeView->get_selected(xLeftIter.get());
1180 auto pLeftSymbol = GetSymbolForIter(*xLeftIter, *m_xLeftTreeView,
m_aLeftTreeSymbolIndex);
1181
1182 auto xRightIter = rTree.make_iterator();
1183 if (!rTree.get_selected(xRightIter.get()))
1184 {
________________________________________________________________________________________________________
To view the defects in Coverity Scan visit,
https://scan.coverity.com/projects/libreoffice?tab=overview