Page MenuHomePhabricator

Possible nullptr dereferencing in plane geometry 3D mapper
Open, NormalPublic

Description

There is an 'if' condition with an assignment and a nullptr check, then if the just assigned value is null, the variable is used.

I discovered this accidentally when I was browsing the code. It did not cause a crash for me, probably the condition never fulfills.

https://phabricator.mitk.org/source/mitk/browse/master/Modules/Core/src/Rendering/mitkPlaneGeometryDataVtkMapper3D.cpp;54c4495d75937c24e6ad1ef59f8a472bbff4f8b1$246

if ((surfacecreatorprop.IsNull()) || (surfacecreatorprop->GetSmartPointer().IsNull()) ||
    ((m_SurfaceCreator =
        dynamic_cast<PlaneGeometryDataToSurfaceFilter *>(surfacecreatorprop->GetSmartPointer().GetPointer()))
       .IsNull()))
{
  m_SurfaceCreator->PlaceByGeometryOn();
  surfacecreatorprop = SmartPointerProperty::New(m_SurfaceCreator);
  GetDataNode()->SetProperty("surfacegeometry", surfacecreatorprop);
}