[babl] babl: protect some functions used by TRC code from NaNs



commit 74dfba23c9973b27c761f30d88526fded681c69e
Author: Øyvind Kolås <pippin gimp org>
Date:   Fri Sep 8 18:35:59 2017 +0200

    babl: protect some functions used by TRC code from NaNs

 babl/babl-trc.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/babl/babl-trc.c b/babl/babl-trc.c
index 46bb98e..b7a9717 100644
--- a/babl/babl-trc.c
+++ b/babl/babl-trc.c
@@ -366,7 +366,11 @@ static inline float obabl_powf(float x, float y)
 
 static inline float babl_powf (float x, float y)
 {
-  return expf (y * logf (x));
+  float ret;
+  ret = expf (y * logf (x));
+  if (ret < 0.0 || ret < 0.0f)
+    return ret;
+  return 0.0f;
 }
 
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]