From 64f167f1835b0331c11ba4615ffc3444820fcfc5 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Thu, 20 Oct 2005 16:19:43 +0000 Subject: [PATCH] * Fix to potential out of range index bug from misanthropia --- code/renderer/tr_shader.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/code/renderer/tr_shader.c b/code/renderer/tr_shader.c index 7e9a37ef..cb040a25 100644 --- a/code/renderer/tr_shader.c +++ b/code/renderer/tr_shader.c @@ -2566,7 +2566,14 @@ qhandle_t RE_RegisterShaderFromImage(const char *name, int lightmapIndex, image_ shader_t *sh; hash = generateHashValue(name, FILE_HASH_SIZE); - + + // 20051020 misantropia -- probably not necessary since this function + // only gets called from tr_font.c with lightmapIndex == LIGHTMAP_2D + // but better safe than sorry. + if ( lightmapIndex >= tr.numLightmaps ) { + lightmapIndex = LIGHTMAP_WHITEIMAGE; + } + // // see if the shader is already loaded //