Permalink
Browse files

Fix hang while rendering text on degenerate polygons (#4908)

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 3dfc920d6892886d925d3449f6eaddb1e6e8bcb6
Showing with 2 additions and 0 deletions.
  1. +2 −0 mapprimitive.c
View
@@ -1251,6 +1251,8 @@ static int getPolygonCenterOfGravity(shapeObj *p, pointObj *lp)
sy = s>0?tsy:-tsy;
}
}
+ if(largestArea == 0) /*degenerate polygon*/
+ return MS_FAILURE;
lp->x = sx/(6*largestArea);
lp->y = sy/(6*largestArea);

0 comments on commit 3dfc920

Please sign in to comment.