Permalink
Browse files

Break potential infinite loop in msProjectSegment (#4961)

  • Loading branch information...
szekerest committed Jul 23, 2014
1 parent fc99472 commit 54dda8c1adbc4a423d0f10706e6ee0502b1c04f4
Showing with 10 additions and 2 deletions.
  1. +10 −2 mapproject.c
View
@@ -254,10 +254,18 @@ static int msProjectSegment( projectionObj *in, projectionObj *out,
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;
else
}
else {
if (midPoint.x == subStart.x && midPoint.y == subStart.y)
return MS_FAILURE; /* break infinite loop */
subStart = midPoint;
}
}
/* -------------------------------------------------------------------- */

0 comments on commit 54dda8c

Please sign in to comment.