[vtk-developers] Memory Bug in vtkDataArray

Brad King brad.king at kitware.com
Mon Jan 29 15:07:08 EST 2007


Daniel Aguilera wrote:
> In vtkDataArray : 367
>     vtkTemplateMacro(
>       void* vfrom1 = fromData1->GetVoidPointer(id1*numComp);
>       void* vfrom2 = fromData2->GetVoidPointer(id2*numComp);
>       void* vto = this->WriteVoidPointer(loc, numComp);
> 
> are erroneous (cause segmentation fault) when 'fromData' and 'this' are
> the same. vfrom* pointers are retrieved BEFORE the call to
> WriteVoidPointer,  which may THEN reallocate the array, making vfrom*
> pointers no longer valid.

Great catch.  I've committed the fix:

/cvsroot/VTK/VTK/Common/vtkDataArray.cxx,v  <--  vtkDataArray.cxx
new revision: 1.73; previous revision: 1.72

Thanks,
-Brad



More information about the vtk-developers mailing list