From 68682d75b5323ebf45d662dd0d1de563442d147f Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Fri, 10 Dec 2021 08:39:21 +0100 Subject: [PATCH] Fix nullptr dereferencing from std::shared_ptr - Finding from fuzzer - closes https://github.com/assimp/assimp/issues/4237 --- code/AssetLib/DXF/DXFLoader.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/AssetLib/DXF/DXFLoader.cpp b/code/AssetLib/DXF/DXFLoader.cpp index 3b20678ad..2f1aa6961 100644 --- a/code/AssetLib/DXF/DXFLoader.cpp +++ b/code/AssetLib/DXF/DXFLoader.cpp @@ -378,6 +378,11 @@ void DXFImporter::ExpandBlockReferences(DXF::Block& bl,const DXF::BlockMap& bloc const DXF::Block& bl_src = *(*it).second; for (std::shared_ptr pl_in : bl_src.lines) { + if (!pl_in) { + ASSIMP_LOG_ERROR("DXF: PolyLine instance is nullptr, skipping."); + continue; + } + std::shared_ptr pl_out = std::shared_ptr(new DXF::PolyLine(*pl_in)); if (bl_src.base.Length() || insert.scale.x!=1.f || insert.scale.y!=1.f || insert.scale.z!=1.f || insert.angle || insert.pos.Length()) {