[Paraview] Segmentation fault when clipping Polyhedra

Lennart Schneiders Lennart.Schneiders at rwth-aachen.de
Mon Oct 31 10:16:58 EDT 2011


Hi Karl,

thank you for verifying the issue. I followed your suggestion and
reported the bug (http://www.paraview.org/Bug/view.php?id=12689).
I just noticed that the example contains three redundant points, the
removal of which does not affect the crashing of Paraview though.

Lennart



On Thu, 2011-10-27 at 21:53 +0200, Karl König wrote:
> Hi Lennart,
> 
> Your file seems correct, especially because saving it again as VTU from
> ParaView yields basically the same file.
> 
> I could reproduce the segfault with ParaView git/master as follows:
>  * Load file
>  * Filters - Clip
>    Clip Type: Plane
>    Origin: 0.3, 0.5, 0.5
>    Normal: 1, 0, 0
>    Tick "Inside Out" checkbox
>    Apply
> (One may need to toggle the checkbox a couple of times and pressing
> Apply each time after toggling until the segfault gets triggered.)
> 
> => 0x00007fffdf00166a in vtkDataSetSurfaceFilter::InsertPolygonInHash
> (this=0x2a09270, ids=0x2bd7cb0, numPts=0, sourceId=0)
>     at /opt/ParaView3.git/VTK/Graphics/vtkDataSetSurfaceFilter.cxx:1797
> 1797      quad = *end;
> (gdb) list 1794
> 1789      vtkIdType* tab = new vtkIdType[numPts];
> 1790      for(int i=0; i<numPts; i++)
> 1791        {
> 1792        tab[i] = ids[(offset+i)%numPts];
> 1793        }
> 1794
> 1795      // Look for existing hex in the hash;
> 1796      end = this->QuadHash + tab[0];
> 1797      quad = *end;
> (gdb) print numPts
> $1 = 0
> (gdb) print tab[0]
> $1 = -614752568
> 
> The segfault is triggered by the variable 'numPts' being zero which
> causes the for-loop in line 1790 being skipped such that the array 'tab'
> is not initialized, but still queried at position 0 in line 1796. So,
> 'end' points to some random location in memory and dereferencing it in
> line 1797 causes the segfault.
> I'm not familiar with the algorithm implemented here, so I'm not sure
> whether a feasible way of avoiding this issue would be to skip execution
> of InsertPolygonInHash() altogether if numPts <= 0. Someone on this list
> will know.
> Probably best if you'd file a bug report at http://www.paraview.org/Bug/
> 
> Karl
> 
> 
> Lennart Schneiders wrote, On 10/24/11 14:25:
> > Hello,
> > 
> > I encounter a segmentation fault when trying to clip an unstructured
> > grid containing more than one polyhedron (cell type 42) in Paraview
> > 3.10.1 64-bit. Clipping a single polyhedron does not yield a seg. fault
> > but gives a non-watertight cell which obviously is not correct. In
> > contrast, slicing works flawlessly.
> > 
> > I wonder if my .vtu file is faulty. A minimal example containing two
> > tetrahedra is given below. Any help is greatly appreciated.
> > 
> > Lennart
> > 
> > ----
> > 
> > <VTKFile type="UnstructuredGrid" version="0.1"
> > byte_order="LittleEndian">
> > <UnstructuredGrid>
> > <Piece NumberOfPoints="8" NumberOfCells="2">
> > <Points>
> > <DataArray type="Float32" NumberOfComponents="3" format="ascii">
> > 0.0 0.0 0.0
> > 1.0 0.0 0.0
> > 0.0 1.0 0.0
> > 0.0 0.0 1.0
> > 0.0 0.0 0.0
> > -1.0 0.0 0.0
> > 0.0 1.0 0.0
> > 0.0 0.0 1.0
> > </DataArray>
> > </Points>
> > <Cells>
> > <DataArray type="Int32" Name="connectivity" format="ascii">
> > 0 1 2 3 4 5 6 7
> > </DataArray>
> > <DataArray type="Int32" Name="offsets" format="ascii">
> > 4 8
> > </DataArray>
> > <DataArray type="UInt8" Name="types" format="ascii">
> > 42 42
> > </DataArray>
> > <DataArray type="UInt32" Name="faces" format="ascii">
> > 4  3 0 1 2  3 0 1 3  3 0 2 3  3 1 2 3
> > 4  3 4 5 6  3 4 5 7  3 4 6 7  3 5 6 7
> > </DataArray>
> > <DataArray type="UInt32" Name="faceoffsets" format="ascii">
> > 17 34
> > </DataArray>
> > </Cells>
> > </Piece>
> > </UnstructuredGrid>
> > </VTKFile>
> > 
> > _______________________________________________
> > Powered by www.kitware.com
> > 
> > Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> > 
> > Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView
> > 
> > Follow this link to subscribe/unsubscribe:
> > http://www.paraview.org/mailman/listinfo/paraview
> 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView
> 
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview




More information about the ParaView mailing list