VTK Crash (through Point Cloud Library) - In vtkOpenGLIndexBufferObject::AppendPointIndexBuffer


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() -

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.

Is this a logic error here? Any suggestions on how to diagnose this if GetNumberOfConnectivityEntries should be greater than GetNumberOfCells? I know it’s possible the bug can be in the point cloud library, but I’m pretty new to both, so I’m unsure where to look. Hoping some guidance from you guys will help me get to the bottom of things more quickly!

I can try to create an example showing the crash, but I figured I’d ask first. Using the point cloud library, I’m trying to draw a point cloud. The first few iterations of the point cloud draw fine, but then it crashes.

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…

Is that subtraction correct? Of course, I could be off base, but from my very limited understanding, that would make more sense. I’ve tried that and it does solve my crash issue.