[Libreoffice-commits] core.git: filter/source

Caolán McNamara caolanm at redhat.com
Sun Oct 29 10:00:56 UTC 2017


 filter/source/graphicfilter/icgm/class4.cxx |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 540cd706db44858247cf69f1f40808f02bd78587
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Oct 28 16:09:18 2017 +0100

    ofz#3872 Divide-by-zero
    
    Change-Id: I851fdb905e0ca981cba6699fcbe20c5d8fabf7ae
    Reviewed-on: https://gerrit.libreoffice.org/44009
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/filter/source/graphicfilter/icgm/class4.cxx b/filter/source/graphicfilter/icgm/class4.cxx
index b079403e691b..8bcb4b3f703a 100644
--- a/filter/source/graphicfilter/icgm/class4.cxx
+++ b/filter/source/graphicfilter/icgm/class4.cxx
@@ -547,7 +547,7 @@ void CGM::ImplDoClass4()
 
             case 0x10 : /*Circular Arc Centre Close*/
             {
-                double fOrientation, fStartAngle, fEndAngle, vector[ 4 ];
+                double fOrientation, vector[ 4 ];
                 FloatPoint aCenter, aRadius;
 
                 if ( mbFigure )
@@ -565,8 +565,10 @@ void CGM::ImplDoClass4()
                 }
                 ImplMapDouble( aRadius.X );
                 aRadius.Y = aRadius.X;
-                fStartAngle = acos( vector[ 0 ] / sqrt( vector[ 0 ] * vector[ 0 ] + vector[ 1 ] * vector[ 1 ] ) ) * 57.29577951308;
-                fEndAngle = acos( vector[ 2 ] / sqrt( vector[ 2 ] * vector[ 2 ] + vector[ 3 ] * vector[ 3 ] ) ) * 57.29577951308;
+                const double fStartSqrt = sqrt(vector[0] * vector[0] + vector[1] * vector[1]);
+                double fStartAngle = fStartSqrt ? (acos(vector[0] / fStartSqrt) * 57.29577951308) : 0.0;
+                const double fEndSqrt = sqrt(vector[2] * vector[2] + vector[3] * vector[3]);
+                double fEndAngle = fEndSqrt ? acos(vector[2] / fEndSqrt) * 57.29577951308 : 0.0;
 
                 if ( vector[ 1 ] > 0 )
                     fStartAngle = 360 - fStartAngle;


More information about the Libreoffice-commits mailing list