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

Eike Rathke erack at redhat.com
Thu Oct 13 13:17:04 UTC 2016


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

New commits:
commit b086fd9923e69b7494fd70e8f62b16c83837f7e6
Author: Eike Rathke <erack at redhat.com>
Date:   Thu Oct 13 15:07:47 2016 +0200

    approxEqual: check isFinite()
    
    Necessary as all comparisons involving a Nan evaluate to false and the
    assert() in isRepresentableInteger() was hit by crash test documents
    where approxEqual() was called with a least one Nan.
    
    Change-Id: I9e8f41c36c0cf14cabf47c3df773c601d32682d6

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 9ce10f7..95df820 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -1095,6 +1095,8 @@ bool SAL_CALL rtl_math_approxEqual(double a, double b) SAL_THROW_EXTERN_C()
     if (a == 0.0 || b == 0.0)
         return false;
     const double d = fabs(a - b);
+    if (!rtl::math::isFinite(d))
+        return false;   // Nan or Inf involved
     if (d > ((a = fabs(a)) * e44) || d > ((b = fabs(b)) * e44))
         return false;
     if (isRepresentableInteger(d) && isRepresentableInteger(a) && isRepresentableInteger(b))


More information about the Libreoffice-commits mailing list