From d40a624718c306558929e3fb77f21d38e31aa74b Mon Sep 17 00:00:00 2001 From: lordhavoc Date: Sun, 7 Jan 2001 16:38:16 +0000 Subject: [PATCH] workaround for bounds checking error in loading texture lump git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@124 d7cf8633-e32d-0410-b094-e92efae38249 --- model_brush.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/model_brush.c b/model_brush.c index d5c8c3e3..d86b498e 100644 --- a/model_brush.c +++ b/model_brush.c @@ -111,6 +111,7 @@ void Mod_LoadTextures (lump_t *l) texture_t *altanims[10]; dmiptexlump_t *m; byte *data; + int *dofs; if (!l->filelen) { @@ -125,12 +126,14 @@ void Mod_LoadTextures (lump_t *l) loadmodel->numtextures = m->nummiptex; loadmodel->textures = Hunk_AllocName (m->nummiptex * sizeof(*loadmodel->textures) , loadname); + // just to work around bounds checking when debugging with it (array index out of bounds error thing) + dofs = m->dataofs; for (i=0 ; inummiptex ; i++) { - m->dataofs[i] = LittleLong(m->dataofs[i]); - if (m->dataofs[i] == -1) + dofs[i] = LittleLong(dofs[i]); + if (dofs[i] == -1) continue; - mt = (miptex_t *)((byte *)m + m->dataofs[i]); + mt = (miptex_t *)((byte *)m + dofs[i]); mt->width = LittleLong (mt->width); mt->height = LittleLong (mt->height); for (j=0 ; j