From eef4de5c2e8ee6dbc76c96e7f42ff8ac0c506889 Mon Sep 17 00:00:00 2001 From: havoc Date: Tue, 24 Dec 2002 22:59:23 +0000 Subject: [PATCH] detect bogus texture upload attempts and print the info to console git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2683 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_textures.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gl_textures.c b/gl_textures.c index 8ad1278f..710d2164 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -959,6 +959,8 @@ static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *iden texinfo = R_GetTexTypeInfo(textype, flags); size = width * height * depth * sides * texinfo->inputbytesperpixel; + if (size < 1) + Sys_Error("R_LoadTexture: bogus texture size (%dx%dx%dx%dbppx%dsides = %d bytes)\n", width, height, depth, texinfo->inputbytesperpixel * 8, sides); // clear the alpha flag if the texture has no transparent pixels switch(textype) @@ -1029,7 +1031,7 @@ static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *iden { glt->inputtexels = Mem_Alloc(texturedatamempool, size); if (glt->inputtexels == NULL) - Sys_Error("R_SetupTexture: out of memory\n"); + Sys_Error("R_LoadTexture: out of memory\n"); memcpy(glt->inputtexels, data, size); } else -- 2.39.2