]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
detect bogus texture upload attempts and print the info to console
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 24 Dec 2002 22:59:23 +0000 (22:59 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 24 Dec 2002 22:59:23 +0000 (22:59 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2683 d7cf8633-e32d-0410-b094-e92efae38249

gl_textures.c

index 8ad1278fe69805f15cb119f352270e1e92d5271d..710d2164010a733a7e9d56cdc0d9eed96b0e9c0e 100644 (file)
@@ -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