summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-10-24 20:42:11 +0200
committerEike Rathke <erack@redhat.com>2015-10-24 20:57:40 +0200
commitcaf093e56f7d9f9223dd546d353d77dffaeb0b9a (patch)
tree3957beb84d0416d0e896c13c072aec6de145e5c1 /sal
parent11fc708e71054dcd512a81981e735db375e79aa4 (diff)
prevent endless recursion through rtl_math_erf* for Inf or NaN
Change-Id: If6eb273bc4d76f85da0844caea4bd697c6263013
Diffstat (limited to 'sal')
-rw-r--r--sal/rtl/math.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index db9b06a2ac36..95990287bec0 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -1141,6 +1141,10 @@ double SAL_CALL rtl_math_erf( double x ) SAL_THROW_EXTERN_C()
if( x == 0.0 )
return 0.0;
+ // Otherwise we may end up in endless recursion through rtl_math_erfc().
+ if (!::rtl::math::isFinite(x))
+ return x;
+
bool bNegative = false;
if ( x < 0.0 )
{
@@ -1177,6 +1181,10 @@ double SAL_CALL rtl_math_erfc( double x ) SAL_THROW_EXTERN_C()
if ( x == 0.0 )
return 1.0;
+ // Otherwise we may end up in endless recursion through rtl_math_erf().
+ if (!::rtl::math::isFinite(x))
+ return x;
+
bool bNegative = false;
if ( x < 0.0 )
{