From 274f64cbf1942328b74d22dcc246d568670a8b68 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 22 Dec 2023 09:45:37 +0100 Subject: [PATCH] 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*) {