A buffer overrun occurs if a map has more than MAX_LIGHTMAPS (256) lightmaps.
Apply diff to renderer/tr_bsp.c.
157a158,160
> } else if ( tr.numLightmaps >= MAX_LIGHTMAPS ) { // 20051020
misantropia
> ri.Printf( PRINT_WARNING, "WARNING: number of lightmaps >
MAX_LIGHTMAPS\n" );
> tr.numLightmaps = MAX_LIGHTMAPS;
Created attachment 797[details]
(Unified) diff -- catch lightmapIndex >= tr.numLightmaps in RE_RegisterShaderFromImage
Avoids a potential out-of-bounds error if RE_RegisterShaderFromImage
(tr_shader.c) is called with a lightmapIndex >= tr.numLightmaps by setting the
lightmapIndex to LIGHTMAP_WHITEIMAGE (full bright). As it is now, this function
is only called from tr_font.c with lightmapIndex == LIGHTMAP_2D but this patch
might come in handy for future use.
Setting a QA contact on all ioquake3 bugs, even resolved ones. Sorry if you get a flood of email from this, it should only happen once. Apologies for the incovenience.
--ryan.
Created attachment 796 [details] (Unified) diff -- catch # lightmaps > MAX_LIGHTMAPS Warn if # lightmaps > MAX_LIGHTMAPS, avoid buffer overrun.
Created attachment 797 [details] (Unified) diff -- catch lightmapIndex >= tr.numLightmaps in RE_RegisterShaderFromImage Avoids a potential out-of-bounds error if RE_RegisterShaderFromImage (tr_shader.c) is called with a lightmapIndex >= tr.numLightmaps by setting the lightmapIndex to LIGHTMAP_WHITEIMAGE (full bright). As it is now, this function is only called from tr_font.c with lightmapIndex == LIGHTMAP_2D but this patch might come in handy for future use.