View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008772VTK(No Category)public2009-03-20 13:322013-04-05 19:57
ReporterSimon Warfield 
Assigned ToBill Lorensen 
PrioritynormalSeveritycrashReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0008772: vtkImageData doesn't use vtkIdType when it should
Description
A variable of type int is used to hold values that can be in the range of vtkIdType and the int overflows for large images, causing processing of large images to fail.

All the occurrences of
int idx;
  in vtkImageData.cxx
should be changed to be
vtkIdType idx;



//----------------------------------------------------------------------------
// This Method returns a pointer to a location in the vtkImageData.
// Coordinates are in pixel units and are relative to the whole
// image origin.
void *vtkImageData::GetArrayPointer(vtkDataArray* array, int coordinate[3])
{
  vtkIdType incs[3];
  int idx;

...

The idx calculation below can overflow, since idx is an int, not a vtkIdType.


  // compute the index of the vector.
  this->GetArrayIncrements(array, incs);
  idx = ((coordinate[0] - extent[0]) * incs[0]
         + (coordinate[1] - extent[2]) * incs[1]
         + (coordinate[2] - extent[4]) * incs[2]);
  // I could check to see if the array has the correct number
  // of tuples for the extent, but that would be an extra multiply.
  if (idx < 0 || idx > array->GetMaxId())
    {
    vtkErrorMacro("Coordinate (" << coordinate[0] << ", " << coordinate[1]
                  << ", " << coordinate[2] << ") out side of array (max = "
                  << array->GetMaxId());
    return NULL;
    }

  return array->GetVoidPointer(idx);
TagsNo tags attached.
Project
Type
Attached Files

 Relationships

  Notes
(0017150)
Simon Warfield (reporter)
2009-08-17 22:51

array->GetMaxId() returns a variable of type vtkIdType, but idx is defined as an int.
This type incompatibility should be fixed by defining idx with
vtkIdType idx;
  instead of
int idx;
  on line 2081
(0017399)
Bill Lorensen (developer)
2009-09-11 19:26

Made changes suggested by reporter.

http://public.kitware.com/cgi-bin/viewcvs.cgi/Filtering/vtkImageData.cxx?r1=1.34&r2=1.35&sortby=date [^]

 Issue History
Date Modified Username Field Change
2009-03-20 13:32 Simon Warfield New Issue
2009-08-17 22:51 Simon Warfield Note Added: 0017150
2009-09-11 19:26 Bill Lorensen Note Added: 0017399
2009-09-11 19:26 Bill Lorensen Status backlog => @80@
2009-09-11 19:26 Bill Lorensen Resolution open => fixed
2009-09-11 19:26 Bill Lorensen Assigned To => Bill Lorensen
2011-06-16 13:11 Zack Galbreath Category => (No Category)
2013-04-05 19:57 Berk Geveci Status customer review => closed


Copyright © 2000 - 2018 MantisBT Team