From 40ab2dfbc272bc92c2951e175a52d508b7328bfe Mon Sep 17 00:00:00 2001 From: havoc Date: Wed, 3 Dec 2008 00:34:17 +0000 Subject: [PATCH] fix for a crash in certain q1bsp maps with very large polygons when cl_stainmaps is on, thanks to Andreas Dehmel for this fix git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8562 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rsurf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gl_rsurf.c b/gl_rsurf.c index 21f5e4c5..dfe530eb 100644 --- a/gl_rsurf.c +++ b/gl_rsurf.c @@ -216,7 +216,7 @@ loc0: s = bound(0, impacts, smax * 16) - impacts; t = bound(0, impactt, tmax * 16) - impactt; i = (int)(s * s + t * t + dist2); - if (i > maxdist) + if ((i > maxdist) || (smax > sizeof(sdtable)/sizeof(sdtable[0]))) // smax overflow fix from Andreas Dehmel continue; // reduce calculations -- 2.39.2