From 88084a67fcb50eafd564096997cde25f4513abb0 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Wed, 20 Dec 2023 19:47:29 +0100 Subject: [PATCH 01/12] Disable Hunter --- .github/workflows/ccpp.yml | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 2c5ca438b..3859c04db 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - name: [ubuntu-latest-g++, macos-latest-clang++, windows-latest-cl.exe, ubuntu-latest-clang++, ubuntu-gcc-hunter, macos-clang-hunter, windows-msvc-hunter] + name: [ubuntu-latest-g++, macos-latest-clang++, windows-latest-cl.exe, ubuntu-latest-clang++] # For Windows msvc, for Linux and macOS let's use the clang compiler, use gcc for Linux. include: - name: windows-latest-cl.exe @@ -35,15 +35,6 @@ jobs: os: ubuntu-latest cxx: g++ cc: gcc - - name: ubuntu-gcc-hunter - os: ubuntu-latest - toolchain: ninja-gcc-cxx17-fpic - - name: macos-clang-hunter - os: macos-latest - toolchain: ninja-clang-cxx17-fpic - - name: windows-msvc-hunter - os: windows-latest - toolchain: ninja-vs-win64-cxx17 steps: - uses: actions/checkout@v4 @@ -55,25 +46,11 @@ jobs: - uses: ilammy/msvc-dev-cmd@v1 - name: Set Compiler Environment - if: "!endsWith(matrix.name, 'hunter')" uses: lukka/set-shell-env@v1 with: CXX: ${{ matrix.cxx }} CC: ${{ matrix.cc }} - - name: Set Compiler Environment for Hunter on Windows - if: startsWith(matrix.name, 'windows') && endsWith(matrix.name, 'hunter') - uses: lukka/set-shell-env@v1 - with: - VS160COMNTOOLS: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools - - - name: Checkout Hunter toolchains - if: endsWith(matrix.name, 'hunter') - uses: actions/checkout@v4 - with: - repository: cpp-pm/polly - path: cmake/polly - - name: Cache DX SDK id: dxcache if: contains(matrix.name, 'windows') From 4034df8b6e7e08efa70d3e645f161b4e2a303bf4 Mon Sep 17 00:00:00 2001 From: Alexander Wagner Date: Thu, 21 Sep 2023 14:26:41 +0200 Subject: [PATCH 02/12] - removed unused include --- include/assimp/types.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/assimp/types.h b/include/assimp/types.h index 42aa0f9eb..9f4edfe0f 100644 --- a/include/assimp/types.h +++ b/include/assimp/types.h @@ -73,6 +73,12 @@ typedef uint32_t ai_uint32; #ifdef __cplusplus +//#ifdef ASSIMP_USE_HUNTER +//# include +//#else +//# include "../contrib/utf8cpp/source/utf8.h" +//#endif + #include #include // for std::nothrow_t #include // for aiString::Set(const std::string&) From e86f1acb9b11e317fe81124cbd38972da04f98d7 Mon Sep 17 00:00:00 2001 From: Alexander Wagner Date: Mon, 27 Nov 2023 20:02:39 +0100 Subject: [PATCH 03/12] - fixed q3bsp issue --- code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp b/code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp index 3c56775e8..a82f29cf1 100644 --- a/code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp +++ b/code/AssetLib/Q3BSP/Q3BSPFileImporter.cpp @@ -395,7 +395,10 @@ void Q3BSPFileImporter::createTriangleTopology(const Q3BSP::Q3BSPModel *pModel, m_pCurrentFace->mIndices = new unsigned int[3]; m_pCurrentFace->mIndices[idx] = vertIdx; } - } + } else { + m_pCurrentFace->mIndices[idx] = vertIdx; + } + pMesh->mVertices[vertIdx].Set(pVertex->vPosition.x, pVertex->vPosition.y, pVertex->vPosition.z); pMesh->mNormals[vertIdx].Set(pVertex->vNormal.x, pVertex->vNormal.y, pVertex->vNormal.z); From d03ab3ef276e4ee8fe4705100c3d1516eea338fc Mon Sep 17 00:00:00 2001 From: Alexander Wagner Date: Wed, 29 Nov 2023 20:28:45 +0100 Subject: [PATCH 04/12] - fixed Exist function on Linux --- code/Common/DefaultIOSystem.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/code/Common/DefaultIOSystem.cpp b/code/Common/DefaultIOSystem.cpp index b28910c70..1bda76e50 100644 --- a/code/Common/DefaultIOSystem.cpp +++ b/code/Common/DefaultIOSystem.cpp @@ -99,12 +99,12 @@ bool DefaultIOSystem::Exists(const char *pFile) const { return false; } #else - FILE *file = ::fopen(pFile, "rb"); - if (!file) { + struct stat statbuf; + stat(pFile, &statbuf); + // test for a regular file + if (!S_ISREG(statbuf.st_mode)){ return false; } - - ::fclose(file); #endif return true; @@ -116,6 +116,7 @@ IOStream *DefaultIOSystem::Open(const char *strFile, const char *strMode) { ai_assert(strFile != nullptr); ai_assert(strMode != nullptr); FILE *file; + #ifdef _WIN32 std::wstring name = Utf8ToWide(strFile); if (name.empty()) { @@ -126,6 +127,7 @@ IOStream *DefaultIOSystem::Open(const char *strFile, const char *strMode) { #else file = ::fopen(strFile, strMode); #endif + if (!file) { return nullptr; } From 3ce8a58d41ceb5c71628c7ccd2907c09b7a09b33 Mon Sep 17 00:00:00 2001 From: Marka Ragnos Date: Sat, 9 Dec 2023 19:01:04 +0100 Subject: [PATCH 05/12] Update DefaultIOSystem.cpp Added missing whitespace --- code/Common/DefaultIOSystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/Common/DefaultIOSystem.cpp b/code/Common/DefaultIOSystem.cpp index 1bda76e50..a72627154 100644 --- a/code/Common/DefaultIOSystem.cpp +++ b/code/Common/DefaultIOSystem.cpp @@ -102,7 +102,7 @@ bool DefaultIOSystem::Exists(const char *pFile) const { struct stat statbuf; stat(pFile, &statbuf); // test for a regular file - if (!S_ISREG(statbuf.st_mode)){ + if (!S_ISREG(statbuf.st_mode)) { return false; } #endif From df33d33e8f9004adcaa6f3c1ad8e03800dca0c9a Mon Sep 17 00:00:00 2001 From: Alexander Wagner Date: Mon, 18 Dec 2023 10:46:48 +0100 Subject: [PATCH 06/12] - removed commented code --- include/assimp/types.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/include/assimp/types.h b/include/assimp/types.h index 9f4edfe0f..42aa0f9eb 100644 --- a/include/assimp/types.h +++ b/include/assimp/types.h @@ -73,12 +73,6 @@ typedef uint32_t ai_uint32; #ifdef __cplusplus -//#ifdef ASSIMP_USE_HUNTER -//# include -//#else -//# include "../contrib/utf8cpp/source/utf8.h" -//#endif - #include #include // for std::nothrow_t #include // for aiString::Set(const std::string&) From 7b54b0f40623b7c5e3a657f03dfe1fa06926ed79 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 21 Dec 2023 20:54:49 +0100 Subject: [PATCH 07/12] Fix leak - closes https://github.com/assimp/assimp/issues/5390 --- code/AssetLib/Irr/IRRLoader.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/AssetLib/Irr/IRRLoader.cpp b/code/AssetLib/Irr/IRRLoader.cpp index 99e053892..2a481a6d8 100644 --- a/code/AssetLib/Irr/IRRLoader.cpp +++ b/code/AssetLib/Irr/IRRLoader.cpp @@ -1234,7 +1234,10 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy // Parse the XML // Find the scene root from document root. const pugi::xml_node &sceneRoot = documentRoot.child("irr_scene"); - if (!sceneRoot) throw new DeadlyImportError("IRR: not found in file"); + if (!sceneRoot) { + delete root; + throw new DeadlyImportError("IRR: not found in file"); + } for (pugi::xml_node &child : sceneRoot.children()) { // XML elements are either nodes, animators, attributes, or materials if (!ASSIMP_stricmp(child.name(), "node")) { From 274f64cbf1942328b74d22dcc246d568670a8b68 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 22 Dec 2023 09:45:37 +0100 Subject: [PATCH 08/12] Check validity of archive without parsing - closes https://github.com/assimp/assimp/issues/5392 --- code/AssetLib/3MF/D3MFImporter.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/code/AssetLib/3MF/D3MFImporter.cpp b/code/AssetLib/3MF/D3MFImporter.cpp index e8529064c..2633bacf4 100644 --- a/code/AssetLib/3MF/D3MFImporter.cpp +++ b/code/AssetLib/3MF/D3MFImporter.cpp @@ -81,12 +81,17 @@ static constexpr aiImporterDesc desc = { "3mf" }; -bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bool /*checkSig*/) const { +bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bool ) const { if (!ZipArchiveIOSystem::isZipArchive(pIOHandler, filename)) { return false; } - D3MF::D3MFOpcPackage opcPackage(pIOHandler, filename); - return opcPackage.validate(); + + ZipArchiveIOSystem archive(pIOHandler, rFile); + if (!mZipArchive->archive()) { + return false; + } + + return true; } void D3MFImporter::SetupProperties(const Importer*) { From b9576e6992ba2ec7b3468d6f51a53d2258ccdc0f Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 22 Dec 2023 10:32:54 +0100 Subject: [PATCH 09/12] Update D3MFImporter.cpp --- code/AssetLib/3MF/D3MFImporter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/AssetLib/3MF/D3MFImporter.cpp b/code/AssetLib/3MF/D3MFImporter.cpp index 2633bacf4..5508c2505 100644 --- a/code/AssetLib/3MF/D3MFImporter.cpp +++ b/code/AssetLib/3MF/D3MFImporter.cpp @@ -85,9 +85,9 @@ bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bo if (!ZipArchiveIOSystem::isZipArchive(pIOHandler, filename)) { return false; } - + static const char *const ModelRef = "3D/3dmodel.model"; ZipArchiveIOSystem archive(pIOHandler, rFile); - if (!mZipArchive->archive()) { + if (!archive.Exists(ModelRef)) { return false; } From 9dddef9b9dff03f341a7a22b0e8d5178f8b1f2d3 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 22 Dec 2023 10:37:34 +0100 Subject: [PATCH 10/12] Update D3MFImporter.cpp --- code/AssetLib/3MF/D3MFImporter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/AssetLib/3MF/D3MFImporter.cpp b/code/AssetLib/3MF/D3MFImporter.cpp index 5508c2505..9a5081db9 100644 --- a/code/AssetLib/3MF/D3MFImporter.cpp +++ b/code/AssetLib/3MF/D3MFImporter.cpp @@ -86,7 +86,7 @@ bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bo return false; } static const char *const ModelRef = "3D/3dmodel.model"; - ZipArchiveIOSystem archive(pIOHandler, rFile); + ZipArchiveIOSystem archive(pIOHandler, filename); if (!archive.Exists(ModelRef)) { return false; } From 69dae9599a4bf7c7ce50a6ed672ef3d017cb1f90 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 22 Dec 2023 11:57:43 +0100 Subject: [PATCH 11/12] Fix integer overflow - closes https://github.com/assimp/assimp/issues/4930 --- code/AssetLib/MDL/MDLMaterialLoader.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/code/AssetLib/MDL/MDLMaterialLoader.cpp b/code/AssetLib/MDL/MDLMaterialLoader.cpp index 3d39fa645..57ed6c7b9 100644 --- a/code/AssetLib/MDL/MDLMaterialLoader.cpp +++ b/code/AssetLib/MDL/MDLMaterialLoader.cpp @@ -123,9 +123,8 @@ aiColor4D MDLImporter::ReplaceTextureWithColor(const aiTexture *pcTexture) { // Read a texture from a MDL3 file void MDLImporter::CreateTextureARGB8_3DGS_MDL3(const unsigned char *szData) { const MDL::Header *pcHeader = (const MDL::Header *)mBuffer; //the endianness is already corrected in the InternReadFile_3DGS_MDL345 function - - VALIDATE_FILE_SIZE(szData + pcHeader->skinwidth * - pcHeader->skinheight); + const size_t len = pcHeader->skinwidth * pcHeader->skinheight); + VALIDATE_FILE_SIZE(szData + len); // allocate a new texture object aiTexture *pcNew = new aiTexture(); From 5d5496f1ad895297cede723b3c96b513263f82ed Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 22 Dec 2023 13:06:10 +0100 Subject: [PATCH 12/12] Update MDLMaterialLoader.cpp --- code/AssetLib/MDL/MDLMaterialLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/AssetLib/MDL/MDLMaterialLoader.cpp b/code/AssetLib/MDL/MDLMaterialLoader.cpp index 57ed6c7b9..f8dafdb3e 100644 --- a/code/AssetLib/MDL/MDLMaterialLoader.cpp +++ b/code/AssetLib/MDL/MDLMaterialLoader.cpp @@ -123,7 +123,7 @@ aiColor4D MDLImporter::ReplaceTextureWithColor(const aiTexture *pcTexture) { // Read a texture from a MDL3 file void MDLImporter::CreateTextureARGB8_3DGS_MDL3(const unsigned char *szData) { const MDL::Header *pcHeader = (const MDL::Header *)mBuffer; //the endianness is already corrected in the InternReadFile_3DGS_MDL345 function - const size_t len = pcHeader->skinwidth * pcHeader->skinheight); + const size_t len = pcHeader->skinwidth * pcHeader->skinheight; VALIDATE_FILE_SIZE(szData + len); // allocate a new texture object