[Libreoffice-commits] core.git: sal/rtl

Eike Rathke erack at redhat.com
Sat Oct 24 18:58:25 UTC 2015


 sal/rtl/math.cxx |    8 ++++++++
 1 file changed, 8 insertions(+)

New commits:
commit caf093e56f7d9f9223dd546d353d77dffaeb0b9a
Author: Eike Rathke <erack at redhat.com>
Date:   Sat Oct 24 20:42:11 2015 +0200

    prevent endless recursion through rtl_math_erf* for Inf or NaN
    
    Change-Id: If6eb273bc4d76f85da0844caea4bd697c6263013

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index db9b06a..9599028 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 )
     {


More information about the Libreoffice-commits mailing list