Skip to content

Commit

Permalink
Ensure that buffer is allocated for the image data before loading.
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueAndi committed Jun 10, 2024
1 parent b62f3d3 commit 47b0504
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/YAWidgets/src/GifImgPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,12 @@ size_t GifImgPlayer::loadImageDataBlock(File& fd, uint8_t* block, size_t size)
bool isSuccessful = true;
uint8_t blockSize = 0U;

if (false == read(fd, &blockSize, sizeof(blockSize)))
if ((nullptr == block) ||
(0U == size))
{
isSuccessful = false;
}
else if (false == read(fd, &blockSize, sizeof(blockSize)))
{
isSuccessful = false;
}
Expand Down

0 comments on commit 47b0504

Please sign in to comment.