Add checks for sane image sizes in some image loaders (bmp, jpg, tga, png)
Thanks @sfan5 for the original patch (got modified a bit): dbd39120e7
Forum: https://irrlicht.sourceforge.io/forum/viewtopic.php?f=2&t=52819&p=306518
Those are the common formats, but rest of image loaders should also call this some day.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6387 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
@@ -232,9 +232,11 @@ IImage* CImageLoaderJPG::loadImage(io::IReadFile* file) const
|
||||
u32 width = cinfo.image_width;
|
||||
u32 height = cinfo.image_height;
|
||||
|
||||
if ( width > JPEG_MAX_DIMENSION || height > JPEG_MAX_DIMENSION )
|
||||
if ( width > JPEG_MAX_DIMENSION || height > JPEG_MAX_DIMENSION
|
||||
|| !IImage::checkDataSizeLimit(IImage::getDataSizeFromFormat(ECF_R8G8B8, width, height))
|
||||
)
|
||||
{
|
||||
os::Printer::log("Image dimensions too large for JPG in file", filename, ELL_WARNING);
|
||||
os::Printer::log("Image dimensions too large in file", filename, ELL_ERROR);
|
||||
longjmp(jerr.setjmp_buffer, 1);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user