diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-10-31 15:42:27 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-11-01 01:26:26 +0100 |
commit | dae6ba564fcf20299b7a560aeb346efc84364d41 (patch) | |
tree | 4ad540434a84d4282a56399f341b7aa7f8ae3b47 /filter | |
parent | 8ea346b87c8f62d93bec283515abae8db36a08ed (diff) |
ofz: Divide-by-zero
Change-Id: Id6153afbfd04ac2eafc8a8670144e157cb527538
Reviewed-on: https://gerrit.libreoffice.org/44126
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/class4.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/filter/source/graphicfilter/icgm/class4.cxx b/filter/source/graphicfilter/icgm/class4.cxx index 8bcb4b3f703a..659eba8d43ad 100644 --- a/filter/source/graphicfilter/icgm/class4.cxx +++ b/filter/source/graphicfilter/icgm/class4.cxx @@ -647,8 +647,10 @@ void CGM::ImplDoClass4() bool bDirection = ImplGetEllipse( aCenter, aRadius, fOrientation ); ImplGetVector( &vector[ 0 ] ); - 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; + double fStartSqrt = sqrt(vector[0] * vector[0] + vector[1] * vector[1]); + fStartAngle = fStartSqrt ? (acos(vector[0] / fStartSqrt) * 57.29577951308) : 0.0; + double fEndSqrt = sqrt(vector[2] * vector[2] + vector[3] * vector[3]); + fEndAngle = fEndSqrt ? (acos(vector[2] / fEndSqrt) * 57.29577951308) : 0.0; if ( vector[ 1 ] > 0 ) fStartAngle = 360 - fStartAngle; |