Implement overflow check in Q3DLoader (#6417)

* Implement overflow check in Q3DLoader
This commit is contained in:
Kim Kulling
2025-12-09 23:28:44 +01:00
committed by GitHub
parent 6ef6d84a7e
commit 7d1fa60aa3
+6 -1
View File
@@ -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<unsigned int>(t1*t2);
// skip the background file name
while (stream.GetI1())