r_alias.c: fix crash on out-of-range skin numbers. This bounds check was in WinQuake, but not FitzQuake.

Fixes crash in malice TC reported by NightFright: http://www.celephais.net/board/view_thread.php?id=60831&start=829

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1204 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Eric Wasylishen 2015-05-01 09:24:06 +00:00
parent 665c81084f
commit 825e5c8f4f

View file

@ -621,7 +621,7 @@ R_DrawAliasModel -- johnfitz -- almost completely rewritten
void R_DrawAliasModel (entity_t *e)
{
aliashdr_t *paliashdr;
int i, anim;
int i, anim, skinnum;
gltexture_t *tx, *fb;
lerpdata_t lerpdata;
@ -683,8 +683,14 @@ void R_DrawAliasModel (entity_t *e)
//
GL_DisableMultitexture();
anim = (int)(cl.time*10) & 3;
tx = paliashdr->gltextures[e->skinnum][anim];
fb = paliashdr->fbtextures[e->skinnum][anim];
skinnum = e->skinnum;
if ((skinnum >= paliashdr->numskins) || (skinnum < 0))
{
Con_DPrintf ("R_DrawAliasModel: no such skin # %d\n", skinnum);
skinnum = 0;
}
tx = paliashdr->gltextures[skinnum][anim];
fb = paliashdr->fbtextures[skinnum][anim];
if (e->colormap != vid.colormap && !gl_nocolors.value)
{
i = e - cl_entities;