diff --git a/Engine/lib/assimp/code/AssetLib/Q3D/Q3DLoader.cpp b/Engine/lib/assimp/code/AssetLib/Q3D/Q3DLoader.cpp index 84a508979..984ad3fd7 100644 --- a/Engine/lib/assimp/code/AssetLib/Q3D/Q3DLoader.cpp +++ b/Engine/lib/assimp/code/AssetLib/Q3D/Q3DLoader.cpp @@ -54,6 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include namespace Assimp { @@ -309,6 +310,11 @@ void Q3DImporter::InternReadFile(const std::string &pFile, throw DeadlyImportError("Quick3D: Invalid texture. Width or height is zero"); } + const unsigned int uint_max = std::numeric_limits::max(); + if (tex->mWidth > (uint_max / tex->mHeight)) { + throw DeadlyImportError("Quick3D: Texture dimensions are too large, resulting in overflow."); + } + unsigned int mul = tex->mWidth * tex->mHeight; aiTexel *begin = tex->pcData = new aiTexel[mul]; aiTexel *const end = &begin[mul - 1] + 1;