Преглед изворни кода

Merge branch 'master' into master

naota29 пре 2 година
родитељ
комит
ab82428bb5
1 измењених фајлова са 7 додато и 2 уклоњено
  1. 7 2
      code/AssetLib/MDL/MDLLoader.cpp

+ 7 - 2
code/AssetLib/MDL/MDLLoader.cpp

@@ -404,8 +404,13 @@ void MDLImporter::InternReadFile_Quake1() {
                     this->CreateTextureARGB8_3DGS_MDL3(szCurrent + iNumImages * sizeof(float));
                 }
                 // go to the end of the skin section / the beginning of the next skin
-                szCurrent += pcHeader->skinheight * pcHeader->skinwidth +
-                             sizeof(float) * iNumImages;
+                bool overflow = false;
+                if ((pcHeader->skinheight > INT_MAX / pcHeader->skinwidth) || (pcHeader->skinwidth > INT_MAX / pcHeader->skinheight)){
+                    overflow = true;
+                }
+                if (!overflow) {
+                    szCurrent += pcHeader->skinheight * pcHeader->skinwidth +sizeof(float) * iNumImages;
+                }
             }
         } else {
             szCurrent += sizeof(uint32_t);