mirror of
https://github.com/raysan5/raylib.git
synced 2025-11-19 08:41:16 +00:00
REVIEWED: LoadImageRaw() #3926
This commit is contained in:
@@ -316,6 +316,8 @@ Image LoadImageRaw(const char *fileName, int width, int height, int format, int
|
||||
unsigned char *dataPtr = fileData;
|
||||
unsigned int size = GetPixelDataSize(width, height, format);
|
||||
|
||||
if (size <= dataSize) // Security check
|
||||
{
|
||||
// Offset file data to expected raw image by header size
|
||||
if ((headerSize > 0) && ((headerSize + size) <= dataSize)) dataPtr += headerSize;
|
||||
|
||||
@@ -325,6 +327,7 @@ Image LoadImageRaw(const char *fileName, int width, int height, int format, int
|
||||
image.height = height;
|
||||
image.mipmaps = 1;
|
||||
image.format = format;
|
||||
}
|
||||
|
||||
UnloadFileData(fileData);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user