mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-17 18:40:02 +00: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 IMAGE_MAXHEIGHT 8192
|
||||||
#define LUMP_MAXWIDTH 1024 // WorldCraft limits
|
#define LUMP_MAXWIDTH 1024 // WorldCraft limits
|
||||||
#define LUMP_MAXHEIGHT 1024
|
#define LUMP_MAXHEIGHT 1024
|
||||||
|
#define PLDECAL_MAXWIDTH 512
|
||||||
|
#define PLDECAL_MAXHEIGHT 512
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -237,7 +237,16 @@ void Image_AddCmdFlags( uint flags )
|
|||||||
|
|
||||||
qboolean Image_ValidSize( const char *name )
|
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 );
|
Con_DPrintf( S_ERROR "Image: (%s) dims out of range [%dx%d]\n", name, image.width, image.height );
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user