Discussion:
[Crystal-develop] Bug in tritri.cpp
Ralph Campbell
2014-01-12 04:45:02 UTC
Permalink
Coverity found an obvious bug in HandlePointsInTriangle()
in libs/csgeom/tritri.cpp but I'm not sure what the fix is.

It accesses tri2[2] but clearly declares tri2[2].

This code hasn't changed in a long time so it's an old bug.
Christian Van Brussel
2014-01-16 16:54:16 UTC
Permalink
Post by Ralph Campbell
Coverity found an obvious bug in HandlePointsInTriangle()
in libs/csgeom/tritri.cpp but I'm not sure what the fix is.
It accesses tri2[2] but clearly declares tri2[2].
Hi,

The methods involved are manipulating triangles, that is arrays of 3
vectors, not 2.

Accessing tri2[2] is therefore OK but it is a priori designed to be
defined as tri2[3].

I fixed the problem in r39976, and looking at that I found another
problem in the coplanar case, it was missing an iteration on the second
triangle, see r39977.

Loading...