Skip to content

Commit

Permalink
Warning on invalid image data (#4179)
Browse files Browse the repository at this point in the history
* Adds log warnings on invalid file data

* Separate error on missing file extension

* Changed LOG_ERROR to LOG_WARNING

---------

Co-authored-by: Jutastre <[email protected]>
  • Loading branch information
Jutastre and Jutastre authored Jul 24, 2024
1 parent bbcb010 commit f5d2f8d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/rtextures.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,16 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i
Image image = { 0 };

// Security check for input data
if ((fileType == NULL) || (fileData == NULL) || (dataSize == 0)) return image;
if ((fileData == NULL) || (dataSize == 0))
{
TRACELOG(LOG_WARNING, "IMAGE: Invalid file data");
return image;
}
if (fileType == NULL)
{
TRACELOG(LOG_WARNING, "IMAGE: Missing file extension");
return image;
}

if ((false)
#if defined(SUPPORT_FILEFORMAT_PNG)
Expand Down

0 comments on commit f5d2f8d

Please sign in to comment.