Warning on invalid image data (#4179)

* Adds log warnings on invalid file data

* Separate error on missing file extension

* Changed LOG_ERROR to LOG_WARNING

---------

Co-authored-by: Jutastre <pukarlindgren@gmail.com>
This commit is contained in:
Jutastre 2024-07-24 21:21:45 +02:00 committed by GitHub
parent bbcb0109e1
commit f5d2f8d545
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 1 deletions

View File

@ -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)