View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001504VTK(No Category)public2005-01-20 11:182016-08-12 09:54
ReporterJeff Lee 
Assigned ToKitware Robot 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0001504: potential for arithmetic exception in vtkPointLocator
DescriptionOn 2d datasets with very small dataset bounds in a coordinate direction, there can be arithmetic exception (SIGFPE) problems in the method GetOverlappingBuckets. When the width (in x, y or z) of the dataset is small but nonzero (BuildLocator accounts for zero width), the algorithm used in GetOverlappingBuckets can fail when trying to cast a large double to an int. The proposed fix is to do the range determination in double precision, then clamp the values, then do the cast and populate the buckets... Here is the method.

  int i, j, k, nei[3];
  int minLevel[3], maxLevel[3];
  double mindLevel[3], maxdLevel[3];
  // Initialize
  buckets->Reset();

  // Determine the range of indices in each direction
  for (i=0; i < 3; i++)
    {
      mindLevel[i] = this->Divisions[i]*((x[i]-dist) - this->Bounds[2*i])/(this->Bounds[2*i+1] - this->Bounds[2*i]);
      maxdLevel[i] = this->Divisions[i]*((x[i]+dist) - this->Bounds[2*i]) / (this->Bounds[2*i+1] - this->Bounds[2*i]);

      // clamp values
      if ( mindLevel[i] < 0 )
        {
        mindLevel[i] = 0;
        }
      if ( maxdLevel[i] >= this->Divisions[i] )
        {
        maxdLevel[i] = this->Divisions[i] - 1;
        }

      // now safe to cast
      minLevel[i] = (int)mindLevel[i];
      maxLevel[i] = (int)maxdLevel[i];
    }

  for ( i= minLevel[0]; i <= maxLevel[0]; i++ )
    {
    for ( j= minLevel[1]; j <= maxLevel[1]; j++ )
      {
      for ( k= minLevel[2]; k <= maxLevel[2]; k++ )
        {
        if ( i < (ijk[0]-level) || i > (ijk[0]+level) ||
             j < (ijk[1]-level) || j > (ijk[1]+level) ||
             k < (ijk[2]-level) || k > (ijk[2]+level))
          {
          nei[0]=i; nei[1]=j; nei[2]=k;
          buckets->InsertNextPoint(nei);
          }
        }
      }
    }
TagsNo tags attached.
Project
Type
Attached Files

 Relationships

  Notes
(0036763)
Kitware Robot (administrator)
2016-08-12 09:54

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current VTK Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2010-09-07 13:47 François Bertel Assigned To François Bertel =>
2011-06-16 13:11 Zack Galbreath Category => (No Category)
2016-08-12 09:54 Kitware Robot Note Added: 0036763
2016-08-12 09:54 Kitware Robot Status expired => closed
2016-08-12 09:54 Kitware Robot Resolution open => moved
2016-08-12 09:54 Kitware Robot Assigned To => Kitware Robot


Copyright © 2000 - 2018 MantisBT Team