1
0

Add IImage::checkDataSizeLimit and make IImage getDataSizeFromFormat return size_t

It's to allow image loader to check for sane limits for image sizes.
Idea came from this patch from sfan5 for Minetest: dbd39120e7
Thought solution is a bit different. 
Image loader checks not yet added (will come soon).
Also note that limit is to s32. While u32 might work mostly it will run into some troubles with color converter for now (which maybe could be changes). Also 2GB ought to be enough for anybody, right?

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6386 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien
2022-05-06 19:47:38 +00:00
parent 76d013d9d6
commit 72b1522083
7 changed files with 41 additions and 26 deletions

View File

@@ -693,8 +693,8 @@ IImage* CImageLoaderDDS::loadImage(io::IReadFile* file) const
s32 width, height;
eDDSPixelFormat pixelFormat;
ECOLOR_FORMAT format = ECF_UNKNOWN;
u32 dataSize = 0;
u32 mipMapsDataSize = 0;
size_t dataSize = 0;
size_t mipMapsDataSize = 0;
bool is3D = false;
bool useAlpha = false;
u32 mipMapCount = 0;