mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2025-01-10 10:25:37 +01:00
engine: imagelib: validate player decal image size (max 512x512)
This commit is contained in:
parent
e48b708fa6
commit
21c898d796
@ -103,6 +103,8 @@ typedef struct imglib_s
|
||||
#define IMAGE_MAXHEIGHT 8192
|
||||
#define LUMP_MAXWIDTH 1024 // WorldCraft limits
|
||||
#define LUMP_MAXHEIGHT 1024
|
||||
#define PLDECAL_MAXWIDTH 512
|
||||
#define PLDECAL_MAXHEIGHT 512
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -237,7 +237,16 @@ void Image_AddCmdFlags( uint flags )
|
||||
|
||||
qboolean Image_ValidSize( const char *name )
|
||||
{
|
||||
if( image.width > IMAGE_MAXWIDTH || image.height > IMAGE_MAXHEIGHT || image.width <= 0 || image.height <= 0 )
|
||||
int max_width = IMAGE_MAXWIDTH;
|
||||
int max_height = IMAGE_MAXHEIGHT;
|
||||
|
||||
if( Image_CheckFlag( IL_LOAD_PLAYER_DECAL ))
|
||||
{
|
||||
max_width = PLDECAL_MAXWIDTH;
|
||||
max_height = PLDECAL_MAXHEIGHT;
|
||||
}
|
||||
|
||||
if( image.width > max_width || image.height > max_height || image.width <= 0 || image.height <= 0 )
|
||||
{
|
||||
Con_DPrintf( S_ERROR "Image: (%s) dims out of range [%dx%d]\n", name, image.width, image.height );
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user