X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=svbsp.c;h=437d82a3b935302a32ebc9a8f4747899d326f4bf;hb=a6984b2a055eb337d57a8c4198fa9a9bb238cd8c;hp=85b82a49d222805e802f26e99c8e3a290a9ac33f;hpb=76e259b17603c4ab2c22bf7238c72847c5dbe505;p=xonotic%2Fdarkplaces.git diff --git a/svbsp.c b/svbsp.c index 85b82a49..437d82a3 100644 --- a/svbsp.c +++ b/svbsp.c @@ -8,7 +8,7 @@ #include "svbsp.h" #include "polygon.h" -#define MAX_SVBSP_POLYGONPOINTS 16 +#define MAX_SVBSP_POLYGONPOINTS 64 #define SVBSP_CLIP_EPSILON (1.0f / 1024.0f) #define SVBSP_DotProduct(a,b) ((a)[0]*(b)[0]+(a)[1]*(b)[1]+(a)[2]*(b)[2]) @@ -409,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++) {