Crash (divide by zero)

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Crash (divide by zero)

Postby aitzolmuelas » Wed May 06, 2015 6:34 am

During one execution, dgCollisionConvexPolygon.cpp line 175:
Code: Select all
points[indexCount] = p0 - dp.Scale3 (test0  / (dp % plane));

(dp % plane) happened to be zero, so the division crashed. This only happened once so far, but divisions should always be checked for epsilon values (unless one is certain that close-to-zero values cannot happen).
aitzolmuelas
 
Posts: 78
Joined: Wed Mar 25, 2015 1:10 pm

Re: Crash (divide by zero)

Postby aitzolmuelas » Wed May 06, 2015 6:41 am

Happened also in line 206 (similar calculation). It happened near the same place in the scenario I am currently testing. Might be coincidence due to some geometric oddity, but I think it should still be bulletproofed.
aitzolmuelas
 
Posts: 78
Joined: Wed Mar 25, 2015 1:10 pm

Re: Crash (divide by zero)

Postby Julio Jerez » Wed May 06, 2015 8:08 am

yes you are right there soudl be a check there, I will take a look when I get home this weekend.
that class has gone some changes in the last month, maybe that is a new problem
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Crash (divide by zero)

Postby Julio Jerez » Wed May 06, 2015 9:56 am

I looked at that code, and I can not see how it can generate a divide by zero.
the denominator can not be zero.
Even if one edge of the polygon is parallel to the plane and p1 - p0 is very short.
I see if I can recreate those conditions.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Crash (divide by zero)

Postby aitzolmuelas » Wed May 06, 2015 12:56 pm

I cannot provide much info, but from the debugger variables, plane was (1, 1, 1), and p0.x was the opposite of p1.z ( it was something like p0=(5.0, 0.0, 0.0) and p1=(0.0, 0.0, -5.0) ).
And no hurry, enjoy the rest of your holidays ^_^
aitzolmuelas
 
Posts: 78
Joined: Wed Mar 25, 2015 1:10 pm

Re: Crash (divide by zero)

Postby aitzolmuelas » Wed May 06, 2015 1:14 pm

Ok, i have it in the debugger now: the exact values are
Code: Select all
p0.m_x =   2.08653641   ,-34.3621864   ,12.6033325
p1.m_x =   2.08653641   ,-4.92221069   ,-16.8366432
dp.m_x =   0.000000000   ,29.4399757   ,-29.4399757

the plane is (1, 1, 1), so dp%plane is indeez exactly zero (it seems like a really odd coincidence, though; I don't really understand what this piece of code is doing yet ;P)
Again, no hurry and enjoy your holidays :)
aitzolmuelas
 
Posts: 78
Joined: Wed Mar 25, 2015 1:10 pm


Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 3 guests