Skip to content

Commit

Permalink
Tile: Fix segfault caused by invalid PNG data
Browse files Browse the repository at this point in the history
  • Loading branch information
SmallJoker authored and sfan5 committed Mar 5, 2023
1 parent e66e583 commit 847ed04
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/client/tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1869,6 +1869,11 @@ bool TextureSource::generateImagePart(std::string part_of_name,
video::IImage* pngimg = vd->createImageFromFile(memfile);
memfile->drop();

if (!pngimg) {
errorstream << "generateImagePart(): Invalid PNG data" << std::endl;
return false;
}

if (baseimg) {
blitBaseImage(pngimg, baseimg);
} else {
Expand Down

0 comments on commit 847ed04

Please sign in to comment.