Hi,
Please find the latest report on new defect(s) introduced to LibreOffice found
with Coverity Scan.
27 new defect(s) introduced to LibreOffice found with Coverity Scan.
3 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 20 of 27 defect(s)
** CID 1681372: (INVALIDATE_ITERATOR)
/sc/source/ui/uitest/uiobject.cxx: 310 in
ScGridWinUIObject::execute(const rtl::OUString &, const std::map<rtl::OUString,
rtl::OUString, std::less<rtl::OUString>, std::allocator<std::pair<const
rtl::OUString, rtl::OUString>>> &)()
/sc/source/ui/uitest/uiobject.cxx: 190 in
ScGridWinUIObject::execute(const rtl::OUString &, const std::map<rtl::OUString,
rtl::OUString, std::less<rtl::OUString>, std::allocator<std::pair<const
rtl::OUString, rtl::OUString>>> &)()
/sc/source/ui/uitest/uiobject.cxx: 334 in
ScGridWinUIObject::execute(const rtl::OUString &, const std::map<rtl::OUString,
rtl::OUString, std::less<rtl::OUString>, std::allocator<std::pair<const
rtl::OUString, rtl::OUString>>> &)()
/sc/source/ui/uitest/uiobject.cxx: 164 in
ScGridWinUIObject::execute(const rtl::OUString &, const std::map<rtl::OUString,
rtl::OUString, std::less<rtl::OUString>, std::allocator<std::pair<const
rtl::OUString, rtl::OUString>>> &)()
/sc/source/ui/uitest/uiobject.cxx: 155 in
ScGridWinUIObject::execute(const rtl::OUString &, const std::map<rtl::OUString,
rtl::OUString, std::less<rtl::OUString>, std::allocator<std::pair<const
rtl::OUString, rtl::OUString>>> &)()
/sc/source/ui/uitest/uiobject.cxx: 173 in
ScGridWinUIObject::execute(const rtl::OUString &, const std::map<rtl::OUString,
rtl::OUString, std::less<rtl::OUString>, std::allocator<std::pair<const
rtl::OUString, rtl::OUString>>> &)()
/sc/source/ui/uitest/uiobject.cxx: 148 in
ScGridWinUIObject::execute(const rtl::OUString &, const std::map<rtl::OUString,
rtl::OUString, std::less<rtl::OUString>, std::allocator<std::pair<const
rtl::OUString, rtl::OUString>>> &)()
_____________________________________________________________________________________________
*** CID 1681372: (INVALIDATE_ITERATOR)
/sc/source/ui/uitest/uiobject.cxx: 310 in
ScGridWinUIObject::execute(const rtl::OUString &, const std::map<rtl::OUString,
rtl::OUString, std::less<rtl::OUString>, std::allocator<std::pair<const
rtl::OUString, rtl::OUString>>> &)()
304 ScViewData& rViewData = mxGridWindow->getViewData();
305 rViewData.GetDispatcher().Execute( pDraw->GetSlotID() ,
SfxCallMode::SLOT | SfxCallMode::RECORD );
306 }
307 else if ( rParameters.contains(u"SETTEXT"_ustr) )
308 {
309 auto itr = rParameters.find(u"SETTEXT"_ustr);
>>> CID 1681372: (INVALIDATE_ITERATOR)
>>> Dereferencing iterator "itr" though it is already past the end of its
>>> container.
310 const OUString rStr = itr->second;
311 ScDocument& rDoc =
mxGridWindow->getViewData().GetDocument();
312 ScAddress aPos( mxGridWindow->getViewData().GetCurX() ,
mxGridWindow->getViewData().GetCurY() ,
mxGridWindow->getViewData().CurrentTabForData() );
313 rDoc.GetOrCreateNote( aPos )->SetText( aPos , rStr );
314 }
315 }
/sc/source/ui/uitest/uiobject.cxx: 190 in
ScGridWinUIObject::execute(const rtl::OUString &, const std::map<rtl::OUString,
rtl::OUString, std::less<rtl::OUString>, std::allocator<std::pair<const
rtl::OUString, rtl::OUString>>> &)()
184 }
185 }
186 }
187 else if ( rParameters.contains(u"OBJECT"_ustr) )
188 {
189 auto itr = rParameters.find(u"OBJECT"_ustr);
>>> CID 1681372: (INVALIDATE_ITERATOR)
>>> Dereferencing iterator "itr" though it is already past the end of its
>>> container.
190 const OUString rStr = itr->second;
191
192 ScDrawView* pDrawView = getDrawView();
193 pDrawView->SelectObject(rStr);
194 }
195 else
/sc/source/ui/uitest/uiobject.cxx: 334 in
ScGridWinUIObject::execute(const rtl::OUString &, const std::map<rtl::OUString,
rtl::OUString, std::less<rtl::OUString>, std::allocator<std::pair<const
rtl::OUString, rtl::OUString>>> &)()
328 }
329 else if (rAction == "SET")
330 {
331 if ( rParameters.contains(u"ZOOM"_ustr) )
332 {
333 auto itr = rParameters.find(u"ZOOM"_ustr);
>>> CID 1681372: (INVALIDATE_ITERATOR)
>>> Dereferencing iterator "itr" though it is already past the end of its
>>> container.
334 OUString aVal = itr->second;
335 sal_Int32 nVal = aVal.toInt32();
336 ScTabViewShell* pViewShell = getViewShell();
337 if( nVal )
338 {
339 ScModule* pScMod = ScModule::get();
/sc/source/ui/uitest/uiobject.cxx: 164 in
ScGridWinUIObject::execute(const rtl::OUString &, const std::map<rtl::OUString,
rtl::OUString, std::less<rtl::OUString>, std::allocator<std::pair<const
rtl::OUString, rtl::OUString>>> &)()
158 pFunc->MarkRange(ScRange(aAddr), true, bExtend);
159 mxGridWindow->CursorChanged();
160 }
161 else if ( rParameters.contains(u"RANGE"_ustr) )
162 {
163 auto itr = rParameters.find(u"RANGE"_ustr);
>>> CID 1681372: (INVALIDATE_ITERATOR)
>>> Dereferencing iterator "itr" though it is already past the end of its
>>> container.
164 const OUString rStr = itr->second;
165 ScRange aRange =
get_range_from_string(mxGridWindow->getViewData().GetDocument(), rStr);
166 ScDBFunc* pFunc = getDBFunc();
167 pFunc->MarkRange(aRange, true, bExtend);
168 mxGridWindow->CursorChanged();
169 }
/sc/source/ui/uitest/uiobject.cxx: 155 in
ScGridWinUIObject::execute(const rtl::OUString &, const std::map<rtl::OUString,
rtl::OUString, std::less<rtl::OUString>, std::allocator<std::pair<const
rtl::OUString, rtl::OUString>>> &)()
149 bExtend = true;
150 }
151
152 if ( rParameters.contains(u"CELL"_ustr) )
153 {
154 auto itr = rParameters.find(u"CELL"_ustr);
>>> CID 1681372: (INVALIDATE_ITERATOR)
>>> Dereferencing iterator "itr" though it is already past the end of its
>>> container.
155 const OUString& rStr = itr->second;
156 ScAddress aAddr =
get_address_from_string(mxGridWindow->getViewData().GetDocument(), rStr);
157 ScDBFunc* pFunc = getDBFunc();
158 pFunc->MarkRange(ScRange(aAddr), true, bExtend);
159 mxGridWindow->CursorChanged();
160 }
/sc/source/ui/uitest/uiobject.cxx: 173 in
ScGridWinUIObject::execute(const rtl::OUString &, const std::map<rtl::OUString,
rtl::OUString, std::less<rtl::OUString>, std::allocator<std::pair<const
rtl::OUString, rtl::OUString>>> &)()
167 pFunc->MarkRange(aRange, true, bExtend);
168 mxGridWindow->CursorChanged();
169 }
170 else if ( rParameters.contains(u"TABLE"_ustr) )
171 {
172 auto itr = rParameters.find(u"TABLE"_ustr);
>>> CID 1681372: (INVALIDATE_ITERATOR)
>>> Dereferencing iterator "itr" though it is already past the end of its
>>> container.
173 const OUString rStr = itr->second;
174 sal_Int32 nTab = rStr.toUInt32();
175 ScTabView* pTabView = mxGridWindow->getViewData().GetView();
176 if (pTabView)
177 {
178 ScDocument& rDoc =
mxGridWindow->getViewData().GetDocument();
/sc/source/ui/uitest/uiobject.cxx: 148 in
ScGridWinUIObject::execute(const rtl::OUString &, const std::map<rtl::OUString,
rtl::OUString, std::less<rtl::OUString>, std::allocator<std::pair<const
rtl::OUString, rtl::OUString>>> &)()
142 if (rAction == "SELECT")
143 {
144 bool bExtend = false;
145 if ( rParameters.contains(u"EXTEND"_ustr) )
146 {
147 auto itr = rParameters.find(u"EXTEND"_ustr);
>>> CID 1681372: (INVALIDATE_ITERATOR)
>>> Dereferencing iterator "itr" though it is already past the end of its
>>> container.
148 if (itr->second.equalsIgnoreAsciiCase("true") ||
itr->second == "1")
149 bExtend = true;
150 }
151
152 if ( rParameters.contains(u"CELL"_ustr) )
153 {
** CID 1681371: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/sc/source/filter/oox/stylesbuffer.cxx: 2501 in
oox::xls::Dxf::setBorder(std::shared_ptr<oox::xls::Border>)()
_____________________________________________________________________________________________
*** CID 1681371: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/sc/source/filter/oox/stylesbuffer.cxx: 2501 in
oox::xls::Dxf::setBorder(std::shared_ptr<oox::xls::Border>)()
2495 {
2496 mxFill = xFill;
2497 }
2498
2499 void Dxf::setBorder(BorderRef xBorder)
2500 {
>>> CID 1681371: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
>>> "xBorder" is copied in call to copy assignment for class
>>> "oox::xls::BorderRef", when it could be moved instead.
2501 mxBorder = xBorder;
2502 }
2503
2504 void Dxf::setFont(FontRef xFont)
2505 {
2506 mxFont = xFont;
** CID 1681370: Null pointer dereferences (FORWARD_NULL)
_____________________________________________________________________________________________
*** CID 1681370: Null pointer dereferences (FORWARD_NULL)
/sc/source/core/tool/autoform.cxx: 326 in
ScAutoFormatData::FillToItemSet(unsigned long, SfxItemSet &) const()
320 {
321 SvxAutoFormatData::FillToItemSet(nIndex, rItemSet);
322
323 ScAutoFormatDataField rField = *GetField(nIndex), rDefault;
324 if (IsFrame())
325 {
>>> CID 1681370: Null pointer dereferences (FORWARD_NULL)
>>> "GetBox" dereferences null "rDefault.m_aBox".
326 if (rField.GetBox() != rDefault.GetBox())
327 {
328 SvxBoxItem aNewBox(rField.GetBox());
329 SvxBoxItem aOldBox(rItemSet.Get(ATTR_BORDER));
330
331 if (!aNewBox.GetTop())
** CID 1681369: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/sc/source/filter/oox/defaulttablestyles.cxx: 100 in
DefaultOOXMLTableStyles::importBorders()()
_____________________________________________________________________________________________
*** CID 1681369: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/sc/source/filter/oox/defaulttablestyles.cxx: 100 in
DefaultOOXMLTableStyles::importBorders()()
94 importBorderElement(xBorder, XLS_TOKEN(right),
rBorderInfo.nRightId);
95 if (rBorderInfo.nVerticalId >= 0)
96 importBorderElement(xBorder, XLS_TOKEN(vertical),
rBorderInfo.nVerticalId);
97 if (rBorderInfo.nHorizontalId >= 0)
98 importBorderElement(xBorder, XLS_TOKEN(horizontal),
rBorderInfo.nHorizontalId);
99
>>> CID 1681369: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
>>> "xBorder" is copied and then passed-by-reference as parameter to STL
>>> insertion function "std::vector<std::shared_ptr<oox::xls::Border>,
>>> std::allocator<std::shared_ptr<oox::xls::Border> >
>>> >::push_back(std::vector<std::shared_ptr<oox::xls::Border>,
>>> std::allocator<std::shared_ptr<oox::xls::Border> > >::value_type const &)",
>>> when it could be moved instead.
100 maBorders.push_back(xBorder);
101 }
102 }
103
104 void DefaultOOXMLTableStyles::importFonts()
105 {
** CID 1681368: (OVERRUN)
/sc/source/core/data/subtotalparam.cxx: 177 in
ScSubTotalParam::SetCustFuncs(unsigned short, std::vector<std::pair<short,
std::unique_ptr<ScTokenArray, std::default_delete<ScTokenArray>>>,
std::allocator<std::pair<short, std::unique_ptr<ScTokenArray,
std::default_delete<ScTokenArray>>>>> &, unsigned short)()
/sc/source/core/data/subtotalparam.cxx: 179 in
ScSubTotalParam::SetCustFuncs(unsigned short, std::vector<std::pair<short,
std::unique_ptr<ScTokenArray, std::default_delete<ScTokenArray>>>,
std::allocator<std::pair<short, std::unique_ptr<ScTokenArray,
std::default_delete<ScTokenArray>>>>> &, unsigned short)()
_____________________________________________________________________________________________
*** CID 1681368: (OVERRUN)
/sc/source/core/data/subtotalparam.cxx: 177 in
ScSubTotalParam::SetCustFuncs(unsigned short, std::vector<std::pair<short,
std::unique_ptr<ScTokenArray, std::default_delete<ScTokenArray>>>,
std::allocator<std::pair<short, std::unique_ptr<ScTokenArray,
std::default_delete<ScTokenArray>>>>> &, unsigned short)()
171 sal_uInt16 nCount )
172 {
173 OSL_ENSURE((nGroup <= MAXSUBTOTAL),
"ScSubTotalParam::SetCustFuncs(): nGroup > MAXSUBTOTAL!");
174 if (nGroup > MAXSUBTOTAL)
175 return;
176
>>> CID 1681368: (OVERRUN)
>>> Overrunning array "this->aGroups" of 3 40-byte elements at element
>>> index 3 (byte offset 159) using index "nGroup" (which evaluates to 3).
177 aGroups[nGroup].AllocCustFuncs(nCount);
178 for (sal_uInt16 i = 0; i < nCount; i++)
179 aGroups[nGroup].pCustFuncs[i] =
std::make_pair(rColFuncs[i].first, std::move(rColFuncs[i].second));
180 }
181
182 void ScSubTotalParam::SetSubLabels(sal_uInt16 nGroup,
/sc/source/core/data/subtotalparam.cxx: 179 in
ScSubTotalParam::SetCustFuncs(unsigned short, std::vector<std::pair<short,
std::unique_ptr<ScTokenArray, std::default_delete<ScTokenArray>>>,
std::allocator<std::pair<short, std::unique_ptr<ScTokenArray,
std::default_delete<ScTokenArray>>>>> &, unsigned short)()
173 OSL_ENSURE((nGroup <= MAXSUBTOTAL),
"ScSubTotalParam::SetCustFuncs(): nGroup > MAXSUBTOTAL!");
174 if (nGroup > MAXSUBTOTAL)
175 return;
176
177 aGroups[nGroup].AllocCustFuncs(nCount);
178 for (sal_uInt16 i = 0; i < nCount; i++)
>>> CID 1681368: (OVERRUN)
>>> Overrunning array "this->aGroups" of 3 40-byte elements at element
>>> index 3 (byte offset 159) using index "nGroup" (which evaluates to 3).
179 aGroups[nGroup].pCustFuncs[i] =
std::make_pair(rColFuncs[i].first, std::move(rColFuncs[i].second));
180 }
181
182 void ScSubTotalParam::SetSubLabels(sal_uInt16 nGroup,
183 std::vector<std::pair<SCCOL, rtl::OUString>>&
rColLabels,
184 sal_uInt16 nCount )
** CID 1681367: Null pointer dereferences (FORWARD_NULL)
_____________________________________________________________________________________________
*** CID 1681367: Null pointer dereferences (FORWARD_NULL)
/sw/source/core/doc/tblafmt.cxx: 410 in
SwTableAutoFormat::UpdateToSet(SfxItemSet &, unsigned long, unsigned long,
unsigned long, unsigned long, SvNumberFormatter *) const()
404 size_t nCols, SvNumberFormatter*
pNFormatr) const
405 {
406 bool bFirstRow = nRow == 0, bLastRow = nRow == nRows - 1, bFirstCol
= nCol == 0,
407 bLastCol = nCol == nCols - 1, bEvenRow = nRow % 2 != 0,
bEvenCol = nCol % 2 != 0;
408
409 SwBoxAutoFormat aDefault;
>>> CID 1681367: Null pointer dereferences (FORWARD_NULL)
>>> "GetBox" dereferences null "aDefault.m_aBox".
410 aItemSet.Put(aDefault.GetBox());
411 aItemSet.Put(aDefault.GetBackground());
412
413 // Background & Body
414 FillToItemSet(BACKGROUND, aItemSet, pNFormatr);
415 FillToItemSet(BODY, aItemSet, pNFormatr);
** CID 1681366: (RESOURCE_LEAK)
/sw/source/core/docnode/ndtbl.cxx: 182 in
lcl_SetDfltBoxAttr(SwTableBox &, unsigned long, unsigned long, unsigned long,
unsigned long, unsigned char, const SwTableAutoFormat *)()
/sw/source/core/docnode/ndtbl.cxx: 182 in
lcl_SetDfltBoxAttr(SwTableBox &, unsigned long, unsigned long, unsigned long,
unsigned long, unsigned char, const SwTableAutoFormat *)()
_____________________________________________________________________________________________
*** CID 1681366: (RESOURCE_LEAK)
/sw/source/core/docnode/ndtbl.cxx: 182 in
lcl_SetDfltBoxAttr(SwTableBox &, unsigned long, unsigned long, unsigned long,
unsigned long, unsigned char, const SwTableAutoFormat *)()
176 else
177 ::lcl_SetDfltBoxAttr( *pNewTableBoxFormat, nId );
178
179 (*pMap)[pBoxFrameFormat] = pNewTableBoxFormat;
180 }
181 rBox.ChgFrameFormat( pNewTableBoxFormat );
>>> CID 1681366: (RESOURCE_LEAK)
>>> Variable "pMap" going out of scope leaks the storage it points to.
182 }
183
184 static SwTableBoxFormat *lcl_CreateDfltBoxFormat( SwDoc &rDoc,
std::vector<SwTableBoxFormat*> &rBoxFormatArr,
185 sal_uInt16 nCols, sal_uInt8 nId )
186 {
187 if ( !rBoxFormatArr[nId] )
/sw/source/core/docnode/ndtbl.cxx: 182 in
lcl_SetDfltBoxAttr(SwTableBox &, unsigned long, unsigned long, unsigned long,
unsigned long, unsigned char, const SwTableAutoFormat *)()
176 else
177 ::lcl_SetDfltBoxAttr( *pNewTableBoxFormat, nId );
178
179 (*pMap)[pBoxFrameFormat] = pNewTableBoxFormat;
180 }
181 rBox.ChgFrameFormat( pNewTableBoxFormat );
>>> CID 1681366: (RESOURCE_LEAK)
>>> Variable "pMap" going out of scope leaks the storage it points to.
182 }
183
184 static SwTableBoxFormat *lcl_CreateDfltBoxFormat( SwDoc &rDoc,
std::vector<SwTableBoxFormat*> &rBoxFormatArr,
185 sal_uInt16 nCols, sal_uInt8 nId )
186 {
187 if ( !rBoxFormatArr[nId] )
** CID 1681365: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/sc/source/core/tool/dbdata.cxx: 1286 in
ScDBData::UpdateReference(const ScDocument &, UpdateRefMode, short, int, short,
short, int, short, short, int, short)()
_____________________________________________________________________________________________
*** CID 1681365: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/sc/source/core/tool/dbdata.cxx: 1286 in
ScDBData::UpdateReference(const ScDocument &, UpdateRefMode, short, int, short,
short, int, short, short, int, short)()
1280 // when the deleted/inserted columns are inside the data range
1281 if (HasAutoFilter() && theCol1 - nOldCol1 != theCol2 -
nOldCol2)
1282 MoveTo(theTab1, theCol1, theRow1, theCol2, theRow2, nCol1);
1283 else
1284 MoveTo( theTab1, theCol1, theRow1, theCol2, theRow2 );
1285 // Do not use SetTableColumnNames() because that resets
mbTableColumnNamesDirty.
>>> CID 1681365: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
>>> "aNames" is copied in call to copy assignment for class
>>> "std::vector<rtl::OUString, std::allocator<rtl::OUString> >", when it could
>>> be moved instead.
1286 maTableColumnNames = aNames;
1287 mbTableColumnNamesDirty = bTableColumnNamesDirty;
1288 }
1289
1290 ScRange aRangeAdvSource;
1291 if ( GetAdvancedQuerySource(aRangeAdvSource) )
** CID 1681364: (DEADCODE)
/sc/source/core/data/tablestyle.cxx: 527 in
ScTableStyle::GetBoxItem(const ScDBData &, short, int, int) const()
/sc/source/core/data/tablestyle.cxx: 572 in
ScTableStyle::GetBoxItem(const ScDBData &, short, int, int) const()
/sc/source/core/data/tablestyle.cxx: 548 in
ScTableStyle::GetBoxItem(const ScDBData &, short, int, int) const()
_____________________________________________________________________________________________
*** CID 1681364: (DEADCODE)
/sc/source/core/data/tablestyle.cxx: 527 in
ScTableStyle::GetBoxItem(const ScDBData &, short, int, int) const()
521 = pBoxItem->GetLine(SvxBoxItemLine::LEFT);
522 const ::editeng::SvxBorderLine* pBLine =
nullptr;
523 if (aRange.aEnd.Row() == nRow)
524 pBLine =
pBoxItem->GetLine(SvxBoxItemLine::BOTTOM);
525 if (pLLine || pBLine)
526 {
>>> CID 1681364: (DEADCODE)
>>> Execution cannot reach the expression "NULL" inside this statement:
>>> "pNewBoxItem.unique_ptr((pPo...".
527 std::unique_ptr<SvxBoxItem>
pNewBoxItem(pPoolItem ? pPoolItem->Clone()
528
: nullptr);
529 if (!pNewBoxItem)
530 pNewBoxItem =
std::make_unique<SvxBoxItem>(ATTR_BORDER);
531 if (pBLine)
532 pNewBoxItem->SetLine(pBLine,
SvxBoxItemLine::BOTTOM);
/sc/source/core/data/tablestyle.cxx: 572 in
ScTableStyle::GetBoxItem(const ScDBData &, short, int, int) const()
566 const ::editeng::SvxBorderLine* pVLine =
nullptr;
567 if (pBoxInfoItem)
568 pVLine = pBoxInfoItem->GetVert();
569
570 if (pBLine || pVLine)
571 {
>>> CID 1681364: (DEADCODE)
>>> Execution cannot reach the expression "NULL" inside this statement:
>>> "pNewBoxItem.unique_ptr((pPo...".
572 std::unique_ptr<SvxBoxItem>
pNewBoxItem(pPoolItem ? pPoolItem->Clone()
573
: nullptr);
574 if (!pNewBoxItem)
575 pNewBoxItem =
std::make_unique<SvxBoxItem>(ATTR_BORDER);
576 if (pBLine)
577 pNewBoxItem->SetLine(pBLine,
SvxBoxItemLine::BOTTOM);
/sc/source/core/data/tablestyle.cxx: 548 in
ScTableStyle::GetBoxItem(const ScDBData &, short, int, int) const()
542 = pBoxItem->GetLine(SvxBoxItemLine::RIGHT);
543 const ::editeng::SvxBorderLine* pBLine =
nullptr;
544 if (aRange.aEnd.Row() == nRow)
545 pBLine =
pBoxItem->GetLine(SvxBoxItemLine::BOTTOM);
546 if (pRLine || pBLine)
547 {
>>> CID 1681364: (DEADCODE)
>>> Execution cannot reach the expression "NULL" inside this statement:
>>> "pNewBoxItem.unique_ptr((pPo...".
548 std::unique_ptr<SvxBoxItem>
pNewBoxItem(pPoolItem ? pPoolItem->Clone()
549
: nullptr);
550 if (!pNewBoxItem)
551 pNewBoxItem =
std::make_unique<SvxBoxItem>(ATTR_BORDER);
552 if (pBLine)
553 pNewBoxItem->SetLine(pBLine,
SvxBoxItemLine::BOTTOM);
** CID 1681363: Null pointer dereferences (FORWARD_NULL)
_____________________________________________________________________________________________
*** CID 1681363: Null pointer dereferences (FORWARD_NULL)
/sw/source/core/doc/tblafmt.cxx: 411 in
SwTableAutoFormat::UpdateToSet(SfxItemSet &, unsigned long, unsigned long,
unsigned long, unsigned long, SvNumberFormatter *) const()
405 {
406 bool bFirstRow = nRow == 0, bLastRow = nRow == nRows - 1, bFirstCol
= nCol == 0,
407 bLastCol = nCol == nCols - 1, bEvenRow = nRow % 2 != 0,
bEvenCol = nCol % 2 != 0;
408
409 SwBoxAutoFormat aDefault;
410 aItemSet.Put(aDefault.GetBox());
>>> CID 1681363: Null pointer dereferences (FORWARD_NULL)
>>> "GetBackground" dereferences null "aDefault.m_aBackground".
411 aItemSet.Put(aDefault.GetBackground());
412
413 // Background & Body
414 FillToItemSet(BACKGROUND, aItemSet, pNFormatr);
415 FillToItemSet(BODY, aItemSet, pNFormatr);
416
** CID 1681362: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/sc/source/filter/oox/defaulttablestyles.cxx: 44 in
DefaultOOXMLTableStyles::importFills()()
_____________________________________________________________________________________________
*** CID 1681362: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/sc/source/filter/oox/defaulttablestyles.cxx: 44 in
DefaultOOXMLTableStyles::importFills()()
38 {
39 size_t nFills = sizeof(aFills) / sizeof(Fill);
40 for (size_t i = 0; i < nFills; ++i)
41 {
42 auto xFill = std::make_shared<oox::xls::Fill>(*this, true);
43 xFill->setFillColors(maColors[aFills[i].nFgColorId],
maColors[aFills[i].nBgColorId]);
>>> CID 1681362: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
>>> "xFill" is copied and then passed-by-reference as parameter to STL
>>> insertion function "std::vector<std::shared_ptr<oox::xls::Fill>,
>>> std::allocator<std::shared_ptr<oox::xls::Fill> >
>>> >::push_back(std::vector<std::shared_ptr<oox::xls::Fill>,
>>> std::allocator<std::shared_ptr<oox::xls::Fill> > >::value_type const &)",
>>> when it could be moved instead.
44 maFills.push_back(xFill);
45 }
46 }
47
48 void DefaultOOXMLTableStyles::importBorderElement(oox::xls::BorderRef
xBorder,
49 sal_Int32
nBorderElement,
** CID 1681361: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/sc/source/filter/oox/defaulttablestyles.cxx: 114 in
DefaultOOXMLTableStyles::importFonts()()
_____________________________________________________________________________________________
*** CID 1681361: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/sc/source/filter/oox/defaulttablestyles.cxx: 114 in
DefaultOOXMLTableStyles::importFonts()()
108 {
109 auto xFont = std::make_shared<oox::xls::Font>(*this, true);
110
111 const Font& rFontInfo = aFonts[i];
112 xFont->setFontElements(maColors[rFontInfo.nThemeColorId],
rFontInfo.bBold);
113
>>> CID 1681361: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
>>> "xFont" is copied and then passed-by-reference as parameter to STL
>>> insertion function "std::vector<std::shared_ptr<oox::xls::Font>,
>>> std::allocator<std::shared_ptr<oox::xls::Font> >
>>> >::push_back(std::vector<std::shared_ptr<oox::xls::Font>,
>>> std::allocator<std::shared_ptr<oox::xls::Font> > >::value_type const &)",
>>> when it could be moved instead.
114 maFonts.push_back(xFont);
115 }
116 }
117
118 void DefaultOOXMLTableStyles::importDxfs()
119 {
** CID 1681360: API usage errors (INVALIDATE_ITERATOR)
/sc/source/filter/excel/xestyle.cxx: 3374 in
XclExpXmlTableStyle::SaveXml(XclExpXmlStream &)()
_____________________________________________________________________________________________
*** CID 1681360: API usage errors (INVALIDATE_ITERATOR)
/sc/source/filter/excel/xestyle.cxx: 3374 in
XclExpXmlTableStyle::SaveXml(XclExpXmlStream &)()
3368 void XclExpXmlTableStyle::SaveXml( XclExpXmlStream& rStrm )
3369 {
3370 sax_fastparser::FSHelperPtr& rStyleSheet =
rStrm.GetCurrentStream();
3371 rStyleSheet->startElement( XML_tableStyle, XML_count,
OString::number(maTableElements.size()), XML_name, maStyleName.toUtf8());
3372 for (auto& rTableStyleElement : maTableElements)
3373 {
>>> CID 1681360: API usage errors (INVALIDATE_ITERATOR)
>>> Dereferencing iterator
>>> "aTableStyleElementToOOXML.find(rTableStyleElement.first)" though it is
>>> already past the end of its container.
3374 rStyleSheet->singleElement( XML_tableStyleElement, XML_dxfId,
OString::number(rTableStyleElement.second), XML_type,
aTableStyleElementToOOXML.find(rTableStyleElement.first)->second);
3375 }
3376 rStyleSheet->endElement(XML_tableStyle);
3377 }
3378
3379 XclExpXmlTableStyles::XclExpXmlTableStyles( const XclExpRoot& rRoot):
** CID 1681359: Incorrect expression (COPY_PASTE_ERROR)
/sc/source/core/data/tablestyle.cxx: 141 in
ScTableStyle::GetFillItem(const ScDBData &, short, int, int) const()
_____________________________________________________________________________________________
*** CID 1681359: Incorrect expression (COPY_PASTE_ERROR)
/sc/source/core/data/tablestyle.cxx: 141 in
ScTableStyle::GetFillItem(const ScDBData &, short, int, int) const()
135 const ScTableStyleParam* pParam = rDBData.GetTableStyleInfo();
136 ScRange aRange;
137 rDBData.GetArea(aRange);
138
139 bool bHasHeader = rDBData.HasHeader();
140 bool bHasTotal = rDBData.HasTotals();
>>> CID 1681359: Incorrect expression (COPY_PASTE_ERROR)
>>> "aStart" in "aRange.aStart" looks like a copy-paste error.
141 if (bHasHeader && mpLastHeaderCellPattern && nRow ==
aRange.aStart.Row()
142 && nCol == aRange.aEnd.Col())
143 {
144 const SvxBrushItem* pPoolItem
145 = GetItemFromPattern(mpLastHeaderCellPattern.get(),
ATTR_BACKGROUND);
146 if (pPoolItem)
** CID 1681358: Incorrect expression (COPY_PASTE_ERROR)
/sc/source/core/data/tablestyle.cxx: 47 in
ScTableStyle::GetFontItemSet(const ScDBData &, short, int, int) const()
_____________________________________________________________________________________________
*** CID 1681358: Incorrect expression (COPY_PASTE_ERROR)
/sc/source/core/data/tablestyle.cxx: 47 in
ScTableStyle::GetFontItemSet(const ScDBData &, short, int, int) const()
41 const ScTableStyleParam* pParam = rDBData.GetTableStyleInfo();
42 ScRange aRange;
43 rDBData.GetArea(aRange);
44
45 bool bHasHeader = rDBData.HasHeader();
46 bool bHasTotal = rDBData.HasTotals();
>>> CID 1681358: Incorrect expression (COPY_PASTE_ERROR)
>>> "aStart" in "aRange.aStart" looks like a copy-paste error.
47 if (bHasHeader && mpLastHeaderCellPattern && nRow ==
aRange.aStart.Row()
48 && nCol == aRange.aEnd.Col())
49 {
50 if (HasFontAttrSet(mpLastHeaderCellPattern.get()))
51 return &mpLastHeaderCellPattern->GetItemSet();
52 }
** CID 1681357: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/sc/source/core/tool/dbdata.cxx: 1243 in
ScDBData::UpdateMoveTab(short, short)()
_____________________________________________________________________________________________
*** CID 1681357: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/sc/source/core/tool/dbdata.cxx: 1243 in
ScDBData::UpdateMoveTab(short, short)()
1237 ::std::vector<OUString> aNames(maTableColumnNames);
1238 bool bTableColumnNamesDirty = mbTableColumnNamesDirty;
1239 // Same column range.
1240 SetArea(nTab, aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(),
1241 aRange.aEnd.Row());
1242 // Do not use SetTableColumnNames() because that resets
mbTableColumnNamesDirty.
>>> CID 1681357: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
>>> "aNames" is copied in call to copy assignment for class
>>> "std::vector<rtl::OUString, std::allocator<rtl::OUString> >", when it could
>>> be moved instead.
1243 maTableColumnNames = aNames;
1244 mbTableColumnNamesDirty = bTableColumnNamesDirty;
1245 }
1246
1247 // MoveTo() is not necessary if only the sheet changed.
1248
** CID 1681356: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/sc/source/filter/oox/stylesbuffer.cxx: 2506 in
oox::xls::Dxf::setFont(std::shared_ptr<oox::xls::Font>)()
_____________________________________________________________________________________________
*** CID 1681356: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/sc/source/filter/oox/stylesbuffer.cxx: 2506 in
oox::xls::Dxf::setFont(std::shared_ptr<oox::xls::Font>)()
2500 {
2501 mxBorder = xBorder;
2502 }
2503
2504 void Dxf::setFont(FontRef xFont)
2505 {
>>> CID 1681356: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
>>> "xFont" is copied in call to copy assignment for class
>>> "oox::xls::FontRef", when it could be moved instead.
2506 mxFont = xFont;
2507 }
2508
2509 void Dxf::importNumFmt( const AttributeList& rAttribs )
2510 {
2511 // don't propagate number formats defined in Dxf entries
** CID 1681355: Incorrect expression (COPY_PASTE_ERROR)
/sc/source/core/data/tablestyle.cxx: 256 in
ScTableStyle::GetBoxItem(const ScDBData &, short, int, int) const()
_____________________________________________________________________________________________
*** CID 1681355: Incorrect expression (COPY_PASTE_ERROR)
/sc/source/core/data/tablestyle.cxx: 256 in
ScTableStyle::GetBoxItem(const ScDBData &, short, int, int) const()
250 const ScTableStyleParam* pParam = rDBData.GetTableStyleInfo();
251 ScRange aRange;
252 rDBData.GetArea(aRange);
253
254 bool bHasHeader = rDBData.HasHeader();
255 bool bHasTotal = rDBData.HasTotals();
>>> CID 1681355: Incorrect expression (COPY_PASTE_ERROR)
>>> "aStart" in "aRange.aStart" looks like a copy-paste error.
256 if (bHasHeader && mpLastHeaderCellPattern && nRow ==
aRange.aStart.Row()
257 && nCol == aRange.aEnd.Col())
258 {
259 const SvxBoxItem* pPoolItem
260 = GetItemFromPattern(mpLastHeaderCellPattern.get(),
ATTR_BORDER);
261 if (mpTablePattern)
** CID 1681354: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/sc/source/filter/oox/defaulttablestyles.cxx: 136 in
DefaultOOXMLTableStyles::importDxfs()()
_____________________________________________________________________________________________
*** CID 1681354: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/sc/source/filter/oox/defaulttablestyles.cxx: 136 in
DefaultOOXMLTableStyles::importDxfs()()
130 xDxf->setBorder(maBorders[aDxfInfo.nBorderId]);
131
132 if (aDxfInfo.nFontId >= 0)
133 xDxf->setFont(maFonts[aDxfInfo.nFontId]);
134
135 xDxf->finalizeImport();
>>> CID 1681354: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
>>> "xDxf" is copied and then passed-by-reference as parameter to STL
>>> insertion function "std::vector<std::shared_ptr<oox::xls::Dxf>,
>>> std::allocator<std::shared_ptr<oox::xls::Dxf> >
>>> >::push_back(std::vector<std::shared_ptr<oox::xls::Dxf>,
>>> std::allocator<std::shared_ptr<oox::xls::Dxf> > >::value_type const &)",
>>> when it could be moved instead.
136 maDxfs.push_back(xDxf);
137 }
138 }
139
140 void DefaultOOXMLTableStyles::importTableStyle(const TableStyle&
rTableStyleInfo)
141 {
** CID 1681353: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/sc/source/filter/oox/stylesbuffer.cxx: 2496 in
oox::xls::Dxf::setFill(std::shared_ptr<oox::xls::Fill>)()
_____________________________________________________________________________________________
*** CID 1681353: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
/sc/source/filter/oox/stylesbuffer.cxx: 2496 in
oox::xls::Dxf::setFill(std::shared_ptr<oox::xls::Fill>)()
2490 mxProtection = std::make_shared<Protection>( *this, true );
2491 return mxProtection;
2492 }
2493
2494 void Dxf::setFill(FillRef xFill)
2495 {
>>> CID 1681353: Performance inefficiencies (COPY_INSTEAD_OF_MOVE)
>>> "xFill" is copied in call to copy assignment for class
>>> "oox::xls::FillRef", when it could be moved instead.
2496 mxFill = xFill;
2497 }
2498
2499 void Dxf::setBorder(BorderRef xBorder)
2500 {
2501 mxBorder = xBorder;
________________________________________________________________________________________________________
To view the defects in Coverity Scan visit,
https://scan.coverity.com/projects/libreoffice?tab=overview