MantisBT - VTK | |||||
| View Issue Details | |||||
| ID | Project | Category | View Status | Date Submitted | Last Update |
| 0001504 | VTK | (No Category) | public | 2005-01-20 11:18 | 2016-08-12 09:54 |
| Reporter | Jeff Lee | ||||
| Assigned To | Kitware Robot | ||||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | closed | Resolution | moved | ||
| Platform | OS | OS Version | |||
| Product Version | |||||
| Target Version | Fixed in Version | ||||
| Project | |||||
| Type | |||||
| Summary | 0001504: potential for arithmetic exception in vtkPointLocator | ||||
| Description | On 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); } } } } | ||||
| Steps To Reproduce | |||||
| Additional Information | |||||
| Tags | No tags attached. | ||||
| Relationships | |||||
| Attached Files | |||||
| 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 | ||
| Notes | |||||
|
|
|||||
|
|
||||