From 34809b18f9353cb957031cc7bd48bf1d9dc12fe4 Mon Sep 17 00:00:00 2001 From: tma Date: Thu, 20 Oct 2005 16:19:43 +0000 Subject: * Fix to potential out of range index bug from misanthropia git-svn-id: svn://svn.icculus.org/quake3/trunk@170 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/renderer/tr_shader.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'code/renderer') diff --git a/code/renderer/tr_shader.c b/code/renderer/tr_shader.c index 7e9a37e..cb040a2 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 // -- cgit v1.2.3