Fix pot. Crash in idWinding2D::ExpandForAxialBox()

it could happen that i is 1 but numPlanes is still 0
(=> if for i = 0:  ( p[j] - p[i] ).LengthSqr() < 0.01f )
so planes[-1] would be accessed which of course is invalid and can crash
This commit is contained in:
Daniel Gibson 2018-12-09 04:23:41 +01:00
parent 885f594a59
commit fd514f2281

View file

@ -84,7 +84,7 @@ void idWinding2D::ExpandForAxialBox( const idVec2 bounds[2] ) {
continue;
}
plane = Plane2DFromPoints( p[i], p[j], true );
if ( i ) {
if ( numPlanes > 0 ) {
if ( GetAxialBevel( planes[numPlanes-1], plane, p[i], bevel ) ) {
planes[numPlanes++] = bevel;
}