Segfault in vtkLineIntegralConvolution2D, missing NULL checks
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
At least VTK 7.0+. Minimal example to reproduce:
//test.cc
#include "vtkLineIntegralConvolution2D.h"
#include "vtkSmartPointer.h"
int
main()
{
vtkSmartPointer<vtkLineIntegralConvolution2D> lic;
lic = vtkSmartPointer<vtkLineIntegralConvolution2D>::New();
return 0;
}
Compile and run:
# g++ test.cc -I/usr/include/vtk/ -L/usr/lib/ -lvtkRenderingLICOpenGL2 -lvtkCommonCore
# ./a.out
Result is a segfault.
Trace:
Thread 1 (Thread 0x7ffff7f6b7c0 (LWP 10475)):
#0 0x00007ffff7b88064 in vtkLineIntegralConvolution2D::SetVTShader(vtkShaderProgram*) () from /usr/lib/libvtkRenderingLICOpenGL2.so.1
No symbol table info available.
#1 0x00007ffff7b889e0 in vtkLineIntegralConvolution2D::~vtkLineIntegralConvolution2D() () from /usr/lib/libvtkRenderingLICOpenGL2.so.1
No symbol table info available.
#2 0x00007ffff7b88b79 in vtkLineIntegralConvolution2D::~vtkLineIntegralConvolution2D() () from /usr/lib/libvtkRenderingLICOpenGL2.so.1
No symbol table info available.
#3 0x0000000000400b78 in vtkSmartPointer<vtkLineIntegralConvolution2D>::~vtkSmartPointer() ()
No symbol table info available.
#4 0x0000000000400ad7 in main ()
No symbol table info available.
Looking at the source code, it is pretty clear that the SetVTShader
gets called with NULL
argument in the vtkLineIntegralConvolution2D destructor. SetVTShader
in turn tries to access this->VTShader
which may be initialized to NULL => segfault
. Missing NULL checks, then? Other setters neglect NULL checks as well.
Edited by Charles Gueunet