Skip to content

Commit

Permalink
Break potential infinite loop in msProjectSegment (#4961)
Browse files Browse the repository at this point in the history
  • Loading branch information
szekerest committed Jul 23, 2014
1 parent fc99472 commit 54dda8c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions mapproject.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -254,10 +254,18 @@ static int msProjectSegment( projectionObj *in, projectionObj *out,


testPoint = midPoint; testPoint = midPoint;


if( msProjectPoint( in, out, &testPoint ) == MS_FAILURE ) if( msProjectPoint( in, out, &testPoint ) == MS_FAILURE ) {
if (midPoint.x == subEnd.x && midPoint.y == subEnd.y)
return MS_FAILURE; /* break infinite loop */

subEnd = midPoint; subEnd = midPoint;
else }
else {
if (midPoint.x == subStart.x && midPoint.y == subStart.y)
return MS_FAILURE; /* break infinite loop */

subStart = midPoint; subStart = midPoint;
}
} }


/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
Expand Down

0 comments on commit 54dda8c

Please sign in to comment.