New Defects reported by Coverity Scan for LibreOffice

scan-admin at coverity.com scan-admin at coverity.com
Fri Oct 2 04:31:33 UTC 2020


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.


New defect(s) Reported-by: Coverity Scan
Showing 3 of 3 defect(s)


** CID 1467667:  Incorrect expression  (DIVIDE_BY_ZERO)
/oox/source/drawingml/diagram/diagramlayoutatoms.cxx: 323 in oox::drawingml::SnakeAlg::layoutShapeChildren(const std::map<int, int, std::less<int>, std::allocator<std::pair<const int, int>>> &, const std::shared_ptr<oox::drawingml::Shape> &, const std::vector<oox::drawingml::Constraint, std::allocator<oox::drawingml::Constraint>> &)()


________________________________________________________________________________________________________
*** CID 1467667:  Incorrect expression  (DIVIDE_BY_ZERO)
/oox/source/drawingml/diagram/diagramlayoutatoms.cxx: 323 in oox::drawingml::SnakeAlg::layoutShapeChildren(const std::map<int, int, std::less<int>, std::allocator<std::pair<const int, int>>> &, const std::shared_ptr<oox::drawingml::Shape> &, const std::vector<oox::drawingml::Constraint, std::allocator<oox::drawingml::Constraint>> &)()
317                 for (auto& aCurrShape : rShape->getChildren())
318                 {
319                     aCurrShape->setPosition(aCurrPos);
320                     awt::Size aCurrSize(aChildSize);
321                     // aShapeWidths items are a portion of nMaxRowWidth. We want the same ratio,
322                     // based on the original parent width, ignoring the aspect ratio request.
>>>     CID 1467667:  Incorrect expression  (DIVIDE_BY_ZERO)
>>>     In expression "static_cast<double>(aShapeWidths[index]) / nMaxRowWidth", division by expression "nMaxRowWidth" which may be zero has undefined behavior.
323                     double fWidthFactor = static_cast<double>(aShapeWidths[index]) / nMaxRowWidth;
324                     bool bWidthsFromConstraints
325                         = nCount >= 2 && rShape->getChildren()[1]->getDataNodeType() == XML_sibTrans;
326                     if (bWidthsFromConstraints)
327                     {
328                         // We can only work from constraints if spacing is represented by a real

** CID 1467666:  Error handling issues  (CHECKED_RETURN)
/sw/source/uibase/utlui/content.cxx: 3232 in SwContentTree::UpdateTracking()()


________________________________________________________________________________________________________
*** CID 1467666:  Error handling issues  (CHECKED_RETURN)
/sw/source/uibase/utlui/content.cxx: 3232 in SwContentTree::UpdateTracking()()
3226         if (!((m_bIsRoot && m_nRootType != ContentTypeId::OUTLINE) ||
3227               m_nOutlineTracking == 3 || nActPos == SwOutlineNodes::npos))
3228         {
3229             // assure outline content type is expanded
3230             // this assumes outline content type is first in treeview
3231             std::unique_ptr<weld::TreeIter> xFirstEntry(m_xTreeView->make_iterator());
>>>     CID 1467666:  Error handling issues  (CHECKED_RETURN)
>>>     Calling "get_iter_first" without checking return value (as is done elsewhere 101 out of 107 times).
3232             m_xTreeView->get_iter_first(*xFirstEntry);
3233             m_xTreeView->expand_row(*xFirstEntry);
3234     
3235             m_xTreeView->all_foreach([this, nActPos](weld::TreeIter& rEntry){
3236                 bool bRet = false;
3237                 if (lcl_IsContent(rEntry, *m_xTreeView) && reinterpret_cast<SwContent*>(

** CID 1467665:  Incorrect expression  (DIVIDE_BY_ZERO)
/oox/source/drawingml/diagram/diagramlayoutatoms.cxx: 255 in oox::drawingml::SnakeAlg::layoutShapeChildren(const std::map<int, int, std::less<int>, std::allocator<std::pair<const int, int>>> &, const std::shared_ptr<oox::drawingml::Shape> &, const std::vector<oox::drawingml::Constraint, std::allocator<oox::drawingml::Constraint>> &)()


________________________________________________________________________________________________________
*** CID 1467665:  Incorrect expression  (DIVIDE_BY_ZERO)
/oox/source/drawingml/diagram/diagramlayoutatoms.cxx: 255 in oox::drawingml::SnakeAlg::layoutShapeChildren(const std::map<int, int, std::less<int>, std::allocator<std::pair<const int, int>>> &, const std::shared_ptr<oox::drawingml::Shape> &, const std::vector<oox::drawingml::Constraint, std::allocator<oox::drawingml::Constraint>> &)()
249                     {
250                         break;
251                     }
252     
253                     nRowWidth += aShapeWidths[i];
254                 }
>>>     CID 1467665:  Incorrect expression  (DIVIDE_BY_ZERO)
>>>     In expression "fShapeHeight * nRow / nRowWidth", division by expression "nRowWidth" which may be zero has undefined behavior.
255                 if ((fShapeHeight * nRow) / nRowWidth >= fAspectRatio)
256                 {
257                     if (nRowWidth > nMaxRowWidth)
258                     {
259                         nMaxRowWidth = nRowWidth;
260                     }


________________________________________________________________________________________________________
To view the defects in Coverity Scan visit, https://u15810271.ct.sendgrid.net/ls/click?upn=HRESupC-2F2Czv4BOaCWWCy7my0P0qcxCbhZ31OYv50ypSs1kiFPuCn2xFdlMIFBirii0zZ9j2-2F9F2XPBcBm2BNgi9duPy3v-2FzgFDd2LJ-2BDKI-3Dv-9t_OTq2XUZbbipYjyLSo6GRo-2FpVxQ9OzkDINu9UTS-2FQhSdO0F0jQniitrGlNxDIzPJi1ILeDWj8f8NKMEDaRBGWYhmIIAMMJCYiTZSwZ1M9a4y9-2BU9BizEY1B7pDuRiy5H2HSYY37EzcNDM1jQ1DGGev-2F8wzqcYnfv-2FafJOsLj2XH2ej-2BwDTwHnQRDoWUfLVfJ-2FHCALNOPwZeYWX0rH-2BXO6oGgUfG1lJJNvhKKkmg8KqSbqLBL3M4fNlzl7QSEqS8P0



More information about the LibreOffice mailing list