Browse Source

[amf] Fix crash when file could not be parsed.

Fix double free of mXmlParser (deleted but not reset in ParseFile, then deleted again in ~AMFImporter).

Should probably use a smart pointer instead, though.

Partially addresses https://github.com/assimp/assimp/issues/3888.
Jason C 4 năm trước cách đây
mục cha
commit
785cca1bb4
1 tập tin đã thay đổi với 1 bổ sung0 xóa
  1. 1 0
      code/AssetLib/AMF/AMFImporter.cpp

+ 1 - 0
code/AssetLib/AMF/AMFImporter.cpp

@@ -268,6 +268,7 @@ void AMFImporter::ParseFile(const std::string &pFile, IOSystem *pIOHandler) {
     mXmlParser = new XmlParser();
     mXmlParser = new XmlParser();
     if (!mXmlParser->parse(file.get())) {
     if (!mXmlParser->parse(file.get())) {
         delete mXmlParser;
         delete mXmlParser;
+        mXmlParser = nullptr;
         throw DeadlyImportError("Failed to create XML reader for file" + pFile + ".");
         throw DeadlyImportError("Failed to create XML reader for file" + pFile + ".");
     }
     }