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

Caolán McNamara caolanm at redhat.com
Thu Oct 26 17:18:12 UTC 2017


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

New commits:
commit d97f0ceb437af5d05e9be220968033a2e5ed7001
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Oct 26 10:59:45 2017 +0100

    ofz#3793 Divide-by-zero
    
    Change-Id: Ica00209bc6679edaa0c83fc7d31bd5d4653b5e96
    Reviewed-on: https://gerrit.libreoffice.org/43879
    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/bitmap.cxx b/filter/source/graphicfilter/icgm/bitmap.cxx
index da83096126a7..72099a3eb076 100644
--- a/filter/source/graphicfilter/icgm/bitmap.cxx
+++ b/filter/source/graphicfilter/icgm/bitmap.cxx
@@ -179,7 +179,7 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
             nX = rDesc.mnR.X - rDesc.mnP.X;
             nY = rDesc.mnR.Y - rDesc.mnP.Y;
 
-            const double fSqrt = sqrt(nX * nX + nY * nY);
+            double fSqrt = sqrt(nX * nX + nY * nY);
             rDesc.mnOrientation = fSqrt != 0.0 ? (acos(nX / fSqrt) * 57.29577951308) : 0.0;
             if ( nY > 0 )
                 rDesc.mnOrientation = 360 - rDesc.mnOrientation;
@@ -193,7 +193,8 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
             nX = fCos * nX + fSin * nY;
             nY = -( fSin * nX - fCos * nY );
 
-            fAngle = acos( nX / sqrt( nX * nX + nY * nY ) ) * 57.29577951308;
+            fSqrt = sqrt(nX * nX + nY * nY);
+            fAngle = fSqrt != 0.0 ? (acos(nX / fSqrt) * 57.29577951308) : 0.0;
             if ( nY > 0 )
                 fAngle = 360 - fAngle;
 


More information about the Libreoffice-commits mailing list