From db4d4bac22d73e93729261739cda06382883b8f8 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 25 Oct 2017 14:40:49 +0100 Subject: ofz#3801 Divide-by-zero MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ibb2f3e5508899541bc201240a7e9d5f26c750fa5 Reviewed-on: https://gerrit.libreoffice.org/43843 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- svx/source/customshapes/EnhancedCustomShapeFontWork.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx index dc5693d0ff71..9d4faa31e5aa 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx @@ -691,6 +691,11 @@ void FitTextOutlinesToShapeOutlines( const tools::PolyPolygon& aOutlines2d, FWDa double fAngle = atan2( -fvx, -fvy ); double fL = hypot( fvx, fvy ); + if (fL == 0.0) + { + SAL_WARN("svx", "FitTextOutlinesToShapeOutlines div-by-zero, abandon fit"); + break; + } fvx = fvx / fL; fvy = fvy / fL; fL = aTextAreaIter->aBoundRect.GetHeight() / 2.0 + aTextAreaIter->aBoundRect.Top() - aParagraphIter->aBoundRect.Center().Y(); -- cgit