[vtk-developers] Re: Bug fix in vtkImageStencilData.cxx

David Gobbi david.gobbi at gmail.com
Wed Dec 5 17:03:14 EST 2007


Hi Karthik,

I looked at the code to see why that check had been left out, and
it looks like r1 should never be set to anything less than rmin to
begin with (except when it is set to VTK_INT_MIN, but there is an if{}
block afterwards that checks for that).

The "r1 = clist[iter++]" line just before the fix you added should
only be executed if (clist[iter] >= rmin) for some previous value
of "iter".  There is a while loop that makes sure of this.

In other words, the only way that r1 would ever be less than rmin
is if the clist[] values are not monotonically increasing, i.e. if the
stencil is bad.

I think it is a good fix, though, because without this extra check,
it is possible for even a small error in the StencilData to cause a
filter to crash.  And that is a bad thing.

   David



On Dec 5, 2007 3:55 PM, Karthik Krishnan <karthik.krishnan at kitware.com> wrote:
> Hello:
>
> I just fixed a bug in vtkImageStencilData. The lowerbound on the returned
> extent (via the method GetNextExtent( ... ) wasn't really clipped by the
> clipping extents as the documentation specifies). If you run into issues,
> please let me know.
>
> http://public.kitware.com/cgi-bin/viewcvs.cgi/Imaging/vtkImageStencilData.cxx?r1=1.23&r2=1.24
>
> Thanks
> --
> Karthik Krishnan
> R&D Engineer,
> Kitware Inc
>



On Dec 5, 2007 3:55 PM, Karthik Krishnan <karthik.krishnan at kitware.com> wrote:
> Hello:
>
> I just fixed a bug in vtkImageStencilData. The lowerbound on the returned
> extent (via the method GetNextExtent( ... ) wasn't really clipped by the
> clipping extents as the documentation specifies). If you run into issues,
> please let me know.
>
> http://public.kitware.com/cgi-bin/viewcvs.cgi/Imaging/vtkImageStencilData.cxx?r1=1.23&r2=1.24
>
> Thanks
> --
> Karthik Krishnan
> R&D Engineer,
> Kitware Inc
>



More information about the vtk-developers mailing list