]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix brushforbox_index integer overflow found by Green - thanks for reporting. And...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 3 Jul 2007 21:28:39 +0000 (21:28 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 3 Jul 2007 21:28:39 +0000 (21:28 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7464 d7cf8633-e32d-0410-b094-e92efae38249

collision.c

index 7bfc9c25d0168d9fc4f3a07f93f7b8ae53314c0b..94c39843f59ae594588836de7ecef3df46829ab1 100644 (file)
@@ -1002,7 +1002,9 @@ void Collision_TraceBrushPolygonTransformFloat(trace_t *trace, const colbrushf_t
 
 
 #define MAX_BRUSHFORBOX 16
-static int brushforbox_index = 0;
+static unsigned int brushforbox_index = 0;
+// note: this relies on integer overflow to be consistent with modulo
+// MAX_BRUSHFORBOX, or in other words, MAX_BRUSHFORBOX must be a power of two!
 static colpointf_t brushforbox_point[MAX_BRUSHFORBOX*8];
 static colplanef_t brushforbox_plane[MAX_BRUSHFORBOX*6];
 static colbrushf_t brushforbox_brush[MAX_BRUSHFORBOX];