From: havoc Date: Mon, 27 Sep 2010 02:44:16 +0000 (+0000) Subject: avoid crashes if MAX_SVBSP_POLYGONPOINTS would be exceeded X-Git-Tag: xonotic-v0.1.0preview~152 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=905ab9e963fd2f970614a6161c1147c586011265;p=xonotic%2Fdarkplaces.git avoid crashes if MAX_SVBSP_POLYGONPOINTS would be exceeded git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10502 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=1ea73c92f65f5f8342edef1d7b4bba7580217176 --- diff --git a/svbsp.c b/svbsp.c index f22947b8..437d82a3 100644 --- a/svbsp.c +++ b/svbsp.c @@ -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++) {