r169 - trunk/code/renderer

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Oct 20 12:14:06 EDT 2005


Author: tma
Date: 2005-10-20 12:14:05 -0400 (Thu, 20 Oct 2005)
New Revision: 169

Modified:
   trunk/code/renderer/tr_bsp.c
Log:
* Fix to buffer overflow in lightmap loading code from misanthropia


Modified: trunk/code/renderer/tr_bsp.c
===================================================================
--- trunk/code/renderer/tr_bsp.c	2005-10-20 01:23:17 UTC (rev 168)
+++ trunk/code/renderer/tr_bsp.c	2005-10-20 16:14:05 UTC (rev 169)
@@ -140,7 +140,7 @@
 	float maxIntensity = 0;
 	double sumIntensity = 0;
 
-    len = l->filelen;
+	len = l->filelen;
 	if ( !len ) {
 		return;
 	}
@@ -155,6 +155,9 @@
 		//FIXME: HACK: maps with only one lightmap turn up fullbright for some reason.
 		//this avoids this, but isn't the correct solution.
 		tr.numLightmaps++;
+	} else if ( tr.numLightmaps >= MAX_LIGHTMAPS ) { // 20051020 misantropia
+		ri.Printf( PRINT_WARNING, "WARNING: number of lightmaps > MAX_LIGHTMAPS\n" );
+		tr.numLightmaps = MAX_LIGHTMAPS;
 	}
 
 	// if we are in r_vertexLight mode, we don't need the lightmaps at all




More information about the quake3-commits mailing list