瀏覽代碼

Fix: Check if index for mesh access is out of range

Kim Kulling 1 年之前
父節點
當前提交
77a8f019e3
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      code/AssetLib/Blender/BlenderModifier.cpp

+ 5 - 0
code/AssetLib/Blender/BlenderModifier.cpp

@@ -283,6 +283,11 @@ void BlenderModifier_Subdivision ::DoIt(aiNode &out, ConversionData &conv_data,
     if (conv_data.meshes->empty()) {
     if (conv_data.meshes->empty()) {
         return;
         return;
     }
     }
+    const size_t meshIndex = conv_data.meshes->size() - out.mNumMeshes;
+    if (meshIndex >= conv_data.meshes->size()) {
+        ASSIMP_LOG_ERROR("Invalid index detected.");
+        return;
+    }
     aiMesh **const meshes = &conv_data.meshes[conv_data.meshes->size() - out.mNumMeshes];
     aiMesh **const meshes = &conv_data.meshes[conv_data.meshes->size() - out.mNumMeshes];
     std::unique_ptr<aiMesh *[]> tempmeshes(new aiMesh *[out.mNumMeshes]());
     std::unique_ptr<aiMesh *[]> tempmeshes(new aiMesh *[out.mNumMeshes]());