New Defects reported by Coverity Scan for LibreOffice

Philippe Jung phil.jung at free.fr
Sat May 9 09:05:53 PDT 2015


> /sw/source/core/draw/dflyobj.cxx: 775 in SwVirtFlyDrawObj::NbcCrop(const Point &, const Fraction &, const Fraction &)()
>>>>     CID 1297232:  Incorrect expression  (DIVIDE_BY_ZERO)
>>>>     In expression "(aGraphicSize.Width() - aCropRectangle.Left() - aCropRectangle.Right()) / (double)aOldRect.GetWidth()", division by expression "aOldRect.GetWidth()" which may be zero has undefined behavior.
> 775         double fScaleX = ( aGraphicSize.Width() - aCropRectangle.Left() - aCropRectangle.Right() ) / (double)aOldRect.GetWidth();
>>>>     CID 1297231:  Incorrect expression  (DIVIDE_BY_ZERO)
>>>>     In expression "(aGraphicSize.Height() - aCropRectangle.Top() - aCropRectangle.Bottom()) / (double)aOldRect.GetHeight()", division by expression "aOldRect.GetHeight()" which may be zero has undefined behavior.
> 776         double fScaleY = ( aGraphicSize.Height() - aCropRectangle.Top() - aCropRectangle.Bottom() ) / (double)aOldRect.GetHeight();

Fixed by https://gerrit.libreoffice.org/#/c/15685/
If someone can merge this into master.

Philippe



More information about the LibreOffice mailing list