Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils.h->InScanArea() may casue stack overflow when oadc equal zero #113

Open
hanhongyi opened this issue Feb 26, 2020 · 0 comments
Open

Comments

@hanhongyi
Copy link

In function :

bool InScanArea(P2TPoint& pa, P2TPoint& pb, P2TPoint& pc, P2TPoint& pd){
p2tFloatType oadb = (pa.x - pb.x)(pd.y - pb.y) - (pd.x - pb.x)(pa.y - pb.y);
if (oadb >= -EPSILON) {
return false;
}

p2tFloatType oadc = (pa.x - pc.x)(pd.y - pc.y) - (pd.x - pc.x)(pa.y - pc.y);
if (oadc <= EPSILON)
{
<<<here!!! if oadc == 0.0f may cause stack overflow

<<< i think oadc may be ...
if (oadc > -EPSILON)
return true;

return false;

}
return true;


data set:

p-> polygon
3 -> size
(X Y) * size

subjection triangles:
p 3 2540 2220 5270 1670 13410 2880

clip polygons:
p 4 8475 1935 14725 1935 14725 7545 8475 7545
p 4 3055 4635 9225 4635 9225 4865 3055 4865
p 4 -6830 5310 7390 5310 7390 14650 -6830 14650
p 4 1060 4980 5360 4980 5360 12140 1060 12140
p 4 3640 1000 4080 1000 4080 8600 3640 8600

ClipType -> XOR
PolyFillType -> pftNonZero

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant