diff --git a/code/AssetLib/Q3D/Q3DLoader.cpp b/code/AssetLib/Q3D/Q3DLoader.cpp index 9c90ce153..ec63643d4 100644 --- a/code/AssetLib/Q3D/Q3DLoader.cpp +++ b/code/AssetLib/Q3D/Q3DLoader.cpp @@ -379,7 +379,12 @@ void Q3DImporter::InternReadFile(const std::string &pFile, light->mColorSpecular = light->mColorDiffuse; // We don't need the rest, but we need to know where this chunk ends. - unsigned int temp = (unsigned int)(stream.GetI4() * stream.GetI4()); + const auto t1 = stream.GetI4(); + const auto t2 = stream.GetI4(); + if (t1 < 0 || t2 < 0) { + throw DeadlyImportError("Quick3D: Overflow detected."); + } + const unsigned int temp = static_cast(t1*t2); // skip the background file name while (stream.GetI1())