[vtk-developers] reproducible vtkXMLImageDataReader + vtkImageCast segfault

Charl P. Botha c.p.botha at ewi.tudelft.nl
Tue Mar 16 06:31:50 EST 2004

Dear developers,

I've attached a Python sample that will segfault.  It creates some VTI
data by reading vtkStructuredPoints from your data dir and writing it as

It then reads this data and passes it through a vtkImageCast. 
Subsequently, it changes the filename to a non-existing one, and re-runs
the pipeline.  The vtkImageCast causes a segfault.

The vtkXMLImageReader, when running into an error during reading, sets
Extent to empty, but UpdateExtent and WholeExtent are left as they were
before.  vtkImageCast (and undoubtedly other filters) are happy as long
as the input is set and UpdateExtent is not empty.

In this case, it derefs a pointer which is not valid anymore and
segfaults badly.

What's the right thing to do here?  If a reader fails to read data,
should it set its output UpdateExtent, WholeExtent and Extent to empty? 
Should filters further along the pipeline be more robust with regards to
this?  Any discussion on this is welcomed.


charl p. botha http://cpbotha.net/ http://visualisation.tudelft.nl/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: crashImageCast.py
Type: text/x-python
Size: 914 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20040316/cf9e5a1d/attachment-0001.py>

More information about the vtk-developers mailing list