X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=svbsp.c;h=437d82a3b935302a32ebc9a8f4747899d326f4bf;hp=e4ef43b5ef0009fd88e07c65050faafc5c768dc2;hb=ff5325c494f56b820830f093d26c2d2480925199;hpb=26ccdc94801f8c893924f624ddfc9bcb0fea1168 diff --git a/svbsp.c b/svbsp.c index e4ef43b5..437d82a3 100644 --- a/svbsp.c +++ b/svbsp.c @@ -158,7 +158,7 @@ static void SVBSP_InsertOccluderPolygonNodes(svbsp_t *b, int *parentnodenumpoint { // now we need to create up to numpoints + 1 new nodes, forming a BSP tree // describing the occluder polygon's shadow volume - int i, j, p, basenum; + int i, j, p; svbsp_node_t *node; // points and lines are valid testers but not occluders @@ -187,7 +187,6 @@ static void SVBSP_InsertOccluderPolygonNodes(svbsp_t *b, int *parentnodenumpoint // note down the first available nodenum for the *parentnodenumpointer // line which is done last to allow multithreaded queries during an // insertion - basenum = b->numnodes; for (i = 0, p = poly->numpoints - 1;i < poly->numpoints;p = i, i++) { #if 1 @@ -410,6 +409,9 @@ int SVBSP_AddPolygon(svbsp_t *b, int numpoints, const float *points, int inserto // note we still allow points and lines to be tested... if (numpoints < 1) return 0; + // if the polygon has too many points, we would crash + if (numpoints > MAX_SVBSP_POLYGONPOINTS) + return 0; poly.numpoints = numpoints; for (i = 0;i < numpoints;i++) {