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 7bfc9c2..94c3984 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];