Jelajahi Sumber

Try to fix issue 4238

- Fix possible nullptr dereferencing.
- closes https://github.com/assimp/assimp/issues/4238
Kim Kulling 3 tahun lalu
induk
melakukan
a6b1a35748
1 mengubah file dengan 4 tambahan dan 1 penghapusan
  1. 4 1
      code/AssetLib/MDL/MDLMaterialLoader.cpp

+ 4 - 1
code/AssetLib/MDL/MDLMaterialLoader.cpp

@@ -448,7 +448,9 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
         unsigned int iType,
         unsigned int iWidth,
         unsigned int iHeight) {
-    std::unique_ptr<aiTexture> pcNew;
+    if (szCurrent == nullptr) {
+        return;
+    }
 
     // get the type of the skin
     unsigned int iMasked = (unsigned int)(iType & 0xF);
@@ -468,6 +470,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
             return;
         }
         
+        std::unique_ptr<aiTexture> pcNew;
         pcNew.reset(new aiTexture);
         pcNew->mHeight = 0;
         pcNew->mWidth = iWidth;