engine: imagelib: img_ktx2: don't allow to load images with no mip levels

This commit is contained in:
Alibek Omarov 2023-12-11 07:06:12 +03:00
parent 683c4874f8
commit a675806c91

View File

@ -87,6 +87,12 @@ static qboolean Image_KTX2Parse( const ktx2_header_t *header, const byte *buffer
return false; return false;
} }
if( header->levelCount == 0 )
{
Con_DPrintf( S_ERROR "%s: file has no mip levels\n", __FUNCTION__ );
return false;
}
if( header->pixelDepth > 1 ) if( header->pixelDepth > 1 )
{ {
Con_DPrintf( S_ERROR "%s: unsupported KTX2 pixelDepth %d\n", __FUNCTION__, header->pixelDepth ); Con_DPrintf( S_ERROR "%s: unsupported KTX2 pixelDepth %d\n", __FUNCTION__, header->pixelDepth );