stefan pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=93df8720f9312206b637cf043a5747e93ed81541

commit 93df8720f9312206b637cf043a5747e93ed81541
Author: Oleksandr Shcherbina <o.shcherb...@samsung.com>
Date:   Wed Jan 13 14:04:34 2016 +0100

    eina: Fix possible wrong value due to null in determinant of matrix
    
    Reviewers: cedric, Hermet
    
    Subscribers: jpeg
    
    Differential Revision: https://phab.enlightenment.org/D3563
---
 src/lib/eina/eina_matrix.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/lib/eina/eina_matrix.c b/src/lib/eina/eina_matrix.c
index 13362f9..d7aeebf 100644
--- a/src/lib/eina/eina_matrix.c
+++ b/src/lib/eina/eina_matrix.c
@@ -1164,7 +1164,9 @@ eina_normal3_matrix_get(Eina_Matrix3 *out, const 
Eina_Matrix4 *m)
    double   i = MATRIX_ZZ(m);
 
    det = a * e * i + b * f * g + c * d * h - g * e * c - h * f * a - i * d * b;
-   det = 1.0 / det;
+
+   if (fabs(det) >= DBL_EPSILON) det = 1.0 / det;
+   else det = 0.0;
 
    MATRIX_XX(out) = (e * i - f * h) * det;
    MATRIX_XY(out) = (h * c - i * b) * det;

-- 


Reply via email to