[vtk-developers] vtkDataArrayTemplate.cxx writes out of bounds when malloc fails
Utkarsh Ayachit
utkarsh.ayachit at kitware.com
Fri Jun 20 16:51:08 EDT 2008
I should have looked at the code before writing the email :).
Looks like on Mac, we currently malloc|copy|free. You are right, for
Macs, that can easily be changed to new|copy|delete, although that may
still not alleviate the problem you are referring to -- let's wait and
see what you get from your test.
Utkarsh
Utkarsh Ayachit wrote:
>
>
> Sean McBride wrote:
> > I redid our tests that started the other thread "vtkImageConvolve
>> crashes when malloc fails". I can confirm that when we see crashes
>> there, we do indeed pass through this Mac-only case of using malloc/
>> memcpy/free instead of realloc. So indeed OS X's crappy realloc is
>> exacerbating our problem.
>
> Indeed, I am not advocating using realloc on Mac due to the broken
> implementation. Infact VTK already uses new|delete on OS X. So, if I am
> not mistaken, Burlen's patch shouldn't make any difference on the Macs.
>
> It's only for most other platforms, where realloc gives us some benefits
> over new|copy|delete that we may want to pause and think before
> committing the changes.
>
> As Burlen had suggested, an easier fix might be to simply throw an
> exception ourselves if the malloc|realloc fails. Thus giving us the
> benefit of using 'new' minus the disadvantages of not using a 'realloc'.
>
> Utkarsh
>
More information about the vtk-developers
mailing list