summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-10-25 09:04:31 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-10-25 13:05:33 +0200
commita24a659d97504a7782574335dd8d1307d727119d (patch)
tree3595f260ceb2d9124bcd29892aae07e8534e1779 /filter
parentec339b183fc6a4f50d691ae48fa5ec699cf04025 (diff)
ofz#3793 Divide-by-zero
Change-Id: Idc18b194840c8d2646426a0346b49348707be5ad Reviewed-on: https://gerrit.libreoffice.org/43806 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/graphicfilter/icgm/bitmap.cxx3
-rw-r--r--filter/source/graphicfilter/icgm/class4.cxx1
2 files changed, 2 insertions, 2 deletions
diff --git a/filter/source/graphicfilter/icgm/bitmap.cxx b/filter/source/graphicfilter/icgm/bitmap.cxx
index 7208fda0ae97..da83096126a7 100644
--- a/filter/source/graphicfilter/icgm/bitmap.cxx
+++ b/filter/source/graphicfilter/icgm/bitmap.cxx
@@ -179,7 +179,8 @@ void CGMBitmap::ImplGetBitmap( CGMBitmapDescriptor& rDesc )
nX = rDesc.mnR.X - rDesc.mnP.X;
nY = rDesc.mnR.Y - rDesc.mnP.Y;
- rDesc.mnOrientation = acos( nX / sqrt( nX * nX + nY * nY ) ) * 57.29577951308;
+ const 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;
diff --git a/filter/source/graphicfilter/icgm/class4.cxx b/filter/source/graphicfilter/icgm/class4.cxx
index 813d07b69f4f..d2c155ee25be 100644
--- a/filter/source/graphicfilter/icgm/class4.cxx
+++ b/filter/source/graphicfilter/icgm/class4.cxx
@@ -32,7 +32,6 @@ double CGM::ImplGetOrientation( FloatPoint const & rCenter, FloatPoint const & r
double nY = rPoint.Y - rCenter.Y;
double fSqrt = sqrt(nX * nX + nY * nY);
-
double fOrientation = fSqrt != 0.0 ? (acos(nX / fSqrt) * 57.29577951308) : 0.0;
if (nY > 0)
fOrientation = 360 - fOrientation;