Skip to content

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

@hanhongyi

Description

@hanhongyi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions