From 0392acc607d26f3fb2681c7d8b0e5ad3a2d50d9a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 9 Sep 2013 09:33:34 +0000 Subject: fix [#36685] crash calculating tangent space data on degenerate geometry the error was that the range check was done on the float before converting to an int. now convert to and int first and ensure a valid range on that. --- intern/mikktspace/mikktspace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'intern/mikktspace') diff --git a/intern/mikktspace/mikktspace.c b/intern/mikktspace/mikktspace.c index 018869f36b6..62aa2da2517 100644 --- a/intern/mikktspace/mikktspace.c +++ b/intern/mikktspace/mikktspace.c @@ -440,8 +440,8 @@ static const int g_iCells = 2048; static NOINLINE int FindGridCell(const float fMin, const float fMax, const float fVal) { const float fIndex = g_iCells * ((fVal-fMin)/(fMax-fMin)); - const int iIndex = fIndex<0?0:((int)fIndex); - return iIndex= 0 ? iIndex : 0) : (g_iCells - 1); } static void MergeVertsFast(int piTriList_in_and_out[], STmpVert pTmpVert[], const SMikkTSpaceContext * pContext, const int iL_in, const int iR_in); -- cgit v1.2.3