From 8bc64ec1475e5e9fd9a3b80236727a1ee80f2fa1 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 15 Apr 2023 11:53:19 +0200 Subject: [PATCH 1/3] Delete License.txt - closes https://github.com/assimp/assimp/issues/4957 --- test/models/glTF2/textureTransform/License.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 test/models/glTF2/textureTransform/License.txt diff --git a/test/models/glTF2/textureTransform/License.txt b/test/models/glTF2/textureTransform/License.txt deleted file mode 100644 index e69de29bb..000000000 From aee4df9be8c403d2d361b28a3fc5f10bef2e445d Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Mon, 17 Apr 2023 15:40:29 +0200 Subject: [PATCH 2/3] Fix possible dereferencing of invalid pointer. - closes https://github.com/assimp/assimp/issues/4918 --- code/AssetLib/Obj/ObjFileImporter.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/code/AssetLib/Obj/ObjFileImporter.cpp b/code/AssetLib/Obj/ObjFileImporter.cpp index 189757815..cf4515794 100644 --- a/code/AssetLib/Obj/ObjFileImporter.cpp +++ b/code/AssetLib/Obj/ObjFileImporter.cpp @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2020, assimp team +Copyright (c) 2006-2023, assimp team All rights reserved. @@ -84,7 +84,6 @@ ObjFileImporter::ObjFileImporter() : // Destructor. ObjFileImporter::~ObjFileImporter() { delete m_pRootObject; - m_pRootObject = nullptr; } // ------------------------------------------------------------------------------------------------ @@ -270,7 +269,7 @@ aiNode *ObjFileImporter::createNodes(const ObjFile::Model *pModel, const ObjFile for (size_t i = 0; i < pObject->m_Meshes.size(); ++i) { unsigned int meshId = pObject->m_Meshes[i]; aiMesh *pMesh = createTopology(pModel, pObject, meshId); - if (pMesh) { + if (pMesh != nullptr) { if (pMesh->mNumFaces > 0) { MeshArray.push_back(pMesh); } else { @@ -324,14 +323,13 @@ aiMesh *ObjFileImporter::createTopology(const ObjFile::Model *pModel, const ObjF return nullptr; } - std::unique_ptr pMesh(new aiMesh); + aiMesh *pMesh = new aiMesh; if (!pObjMesh->m_name.empty()) { pMesh->mName.Set(pObjMesh->m_name); } for (size_t index = 0; index < pObjMesh->m_Faces.size(); index++) { const ObjFile::Face *inp = pObjMesh->m_Faces[index]; - //ai_assert(nullptr != inp); if (inp->mPrimitiveType == aiPrimitiveType_LINE) { pMesh->mNumFaces += static_cast(inp->m_vertices.size() - 1); @@ -387,9 +385,9 @@ aiMesh *ObjFileImporter::createTopology(const ObjFile::Model *pModel, const ObjF } // Create mesh vertices - createVertexArray(pModel, pData, meshIndex, pMesh.get(), uiIdxCount); + createVertexArray(pModel, pData, meshIndex, pMesh, uiIdxCount); - return pMesh.release(); + return pMesh; } // ------------------------------------------------------------------------------------------------ From ca937788ee10ed86646fd04e53f1111f65abea95 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Mon, 17 Apr 2023 20:08:58 +0200 Subject: [PATCH 3/3] Fix: Fix leak in Scope class, FBX - closes https://github.com/assimp/assimp/issues/3421 --- code/AssetLib/FBX/FBXParser.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/code/AssetLib/FBX/FBXParser.cpp b/code/AssetLib/FBX/FBXParser.cpp index d71321452..a8e766873 100644 --- a/code/AssetLib/FBX/FBXParser.cpp +++ b/code/AssetLib/FBX/FBXParser.cpp @@ -188,15 +188,19 @@ Scope::Scope(Parser& parser,bool topLevel) ParseError("unexpected content: empty string."); } - elements.insert(ElementMap::value_type(str,new_Element(*n,parser))); - + auto *element = new_Element(*n, parser); + // Element() should stop at the next Key token (or right after a Close token) n = parser.CurrentToken(); if (n == nullptr) { if (topLevel) { + elements.insert(ElementMap::value_type(str, element)); return; } ParseError("unexpected end of file",parser.LastToken()); + delete element; + } else { + elements.insert(ElementMap::value_type(str, element)); } } }