Skip to content

Commit

Permalink
Fix hang while rendering text on degenerate polygons (#4908)
Browse files Browse the repository at this point in the history
center-of-gravity calculation was returning NaNs which in turn caused
agg's rasterizer to hang
  • Loading branch information
tbonfort committed Nov 22, 2015
1 parent ab2a612 commit 3dfc920
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mapprimitive.c
Expand Up @@ -1251,6 +1251,8 @@ static int getPolygonCenterOfGravity(shapeObj *p, pointObj *lp)
sy = s>0?tsy:-tsy; sy = s>0?tsy:-tsy;
} }
} }
if(largestArea == 0) /*degenerate polygon*/
return MS_FAILURE;


lp->x = sx/(6*largestArea); lp->x = sx/(6*largestArea);
lp->y = sy/(6*largestArea); lp->y = sy/(6*largestArea);
Expand Down

0 comments on commit 3dfc920

Please sign in to comment.