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

Caolán McNamara caolanm at redhat.com
Wed Oct 25 11:11:14 UTC 2017


 filter/source/graphicfilter/icgm/class4.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit faf2bd9c695733fb1414c094ace01c9b123aa9ca
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Oct 25 09:07:36 2017 +0100

    ofz#3790 Divide-by-zero
    
    Change-Id: Id6c1eb3dcf95e9cdc68c0898dc472aaac5d430d2
    Reviewed-on: https://gerrit.libreoffice.org/43807
    Tested-by: Jenkins <ci at libreoffice.org>
    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 d2c155ee25be..b079403e691b 100644
--- a/filter/source/graphicfilter/icgm/class4.cxx
+++ b/filter/source/graphicfilter/icgm/class4.cxx
@@ -512,8 +512,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]);
+                fStartAngle = fStartSqrt != 0.0 ? (acos(vector[0] / fStartSqrt) * 57.29577951308) : 0.0;
+                const double fEndSqrt = sqrt(vector[2] * vector[ 2 ] + vector[3] * vector[3]);
+                fEndAngle = fEndSqrt != 0.0 ? (acos(vector[ 2 ] / fEndSqrt) * 57.29577951308) : 0.0;
 
                 if ( vector[ 1 ] > 0 )
                     fStartAngle = 360 - fStartAngle;


More information about the Libreoffice-commits mailing list