[vtk-developers] reproducible vtkImagePlaneWidget(?) bug

Charl P. Botha c.p.botha at its.tudelft.nl
Fri May 9 21:49:03 EDT 2003


On Sat, May 10, 2003 at 02:24:53AM +0200, Charl P. Botha wrote:
> On Sat, May 10, 2003 at 02:20:26AM +0200, Charl P. Botha wrote:
> > I have attached a short VTK Python script which bugs badly under Windows
> > (but not under Linux).  In short, if one connects something with an empty
> 
> This time, I'm actually going to attach it.

Okay, I've found the bug.  Dean, in the vtkImagePlaneWidget::UpdateNormal,
you have the following check:

  int extentX = 1;
  while (extentX < planeSizeX/spacingX)
    {
    extentX = extentX << 1;
    }

  int extentY = 1;
  while (extentY < planeSizeY/spacingY)
    {
    extentY = extentY << 1;
    }
    
So, if the input data is "empty" (as illustrated by the Python example
attached to my previous mail), spacingX and spacingY are incredibly small
numbers and planeSizeX and planeSizeY are incredibly large (just confirmed
with my trusty debugger) so that planeSizeX/spacingX results in even more
incredibly large values which means that we sit in that loop for a very long
time.  It looks like extentX might even be wrapping, which means it will
stay in that loop forever.

Under Windows, the code bugged depending on whether I was compiling with or
without optimisations.  I believe this has to do with implicit variable init
by the compiler, which would also explain the discrepancy between Windows
and Linux with regards to this bug.

I believe some sanity checks are called for in vtkImagePlaneWidget.cxx.
Your thoughts?

Thanks,
Charl

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



More information about the vtk-developers mailing list