VTK Crash (through Point Cloud Library) - In vtkOpenGLIndexBufferObject::AppendPointIndexBuffer
Hi,
I'm trying to diagnose a crash I'm running into while drawing a point cloud using the PCL library.
The crash is happening in vtkOpenGLIndexBufferObject, in vtkOpenGLIndexBufferObject::AppendPointIndexBuffer. Specifically, this logic:
size_t targetSize = indexArray.size() +
cells->GetNumberOfConnectivityEntries() -
cells->GetNumberOfCells();
I'm running into cases where GetNumberOfCells is larger than GetNumberOfConnectivityEntries. Since indexArray's size is 0, this leads to a extremely large # given it is subtracting a larger number from a smaller number. And, as the code is trying to reserve this space in a vector, it fails and crashes. Should these values be added together, not subtracted?
Some info about my setup:
- Using VTK 8.2.0
- Using PCL 1.9.1
- On Windows 10, packages were installed through vcpkg if that matters...
I have also attached a zip file containing CMake file and main.cpp (and some point cloud data) that should help reproduce what is happening. It doesn't seem to predictably crash on the same point cloud every time. It seems to change. pointCloudCrash.zip