RenderKit / ospray

An Open, Scalable, Portable, Ray Tracing Based Rendering Engine for High-Fidelity Visualization
http://ospray.org
Apache License 2.0
997 stars 182 forks source link

Segfault due to null Data object #395

Closed paulmelis closed 4 years ago

paulmelis commented 4 years ago

In the process of updating ospray-python to the latest API changes it seems 793b1a891782fc799ede8981002181ecde370276 causes issues as it makes the assumption dataRef is not null, which fails in some cases.

https://github.com/ospray/ospray/blob/5d7604085906d8ba33cb4ef4b6ebde1a8cf55d09/ospray/common/Data.h#L233-L241:

It shows up with ospTutorialCpp but not with ospExamples or ospTutorial:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff71662c0 in ospray::Data::size (this=0x0) at /home/paulm/c/ospray-git/ospray/common/Data.h:251
251     return numItems.x * numItems.y * numItems.z;
(gdb) bt
#0  0x00007ffff71662c0 in ospray::Data::size (this=0x0) at /home/paulm/c/ospray-git/ospray/common/Data.h:251
#1  0x00007ffff71975a5 in ospray::ispc (dataRef=...) at /home/paulm/c/ospray-git/ospray/common/Data.h:235
#2  0x00007ffff7197335 in ospray::GeometricModel::commit (this=0x555555597010)
    at /home/paulm/c/ospray-git/ospray/geometry/GeometricModel.cpp:79
#3  0x00007ffff714113b in ospray::api::ISPCDevice::commit (this=0x555555594a50, _object=0x555555597010)
    at /home/paulm/c/ospray-git/ospray/api/ISPCDevice.cpp:391
#4  0x00007ffff7f88e31 in ospCommit (_object=0x555555597010) at /home/paulm/c/ospray-git/ospray/api/API.cpp:549
#5  0x0000555555562d33 in ospray::cpp::ManagedObject<osp::GeometricModel*, (OSPDataType)134217832>::commit (
    this=0x7fffffffd6f0) at /home/paulm/c/ospray-git/ospray/include/ospray/ospray_cpp/ManagedObject.h:176
#6  0x0000555555560e0d in main (argc=1, argv=0x7fffffffd968)
    at /home/paulm/c/ospray-git/apps/ospTutorial/ospTutorial.cpp:116
johguenther commented 4 years ago

Wow, very quick feedback, thanks! Fixed in 00c351816e63ac17cf41149787eafbb9e1eb89ce.