[vtk-developers] Help with vtkImageDataGeometryFilter.cxx:250...

David Gobbi david.gobbi at gmail.com
Fri Mar 8 19:38:13 EST 2013


Hi Sean,

The code should be:

  newPolys->Allocate(newPolys->EstimateSize(numPolys,4));

I looked at EstimateSize(), it is an inline function that does not use "this".
So the generated inline code never actually dereferences a NULL.
It should be a static method, I suppose.

 - David

On Fri, Mar 8, 2013 at 5:25 PM, Sean McBride <sean at rogue-research.com> wrote:
> Hi again!
>
> clang's -fsanitize=null gives:
>
> Filters/Geometry/vtkImageDataGeometryFilter.cxx:250:28: runtime error: member call on null pointer of type 'vtkCellArray'
>
> on this line:
>
>   newPolys->Allocate(newLines->EstimateSize(numPolys,4));
>
> Looking at the code, it does indeed seem that in the "case 2:" branch, 'newLines' is never set.
>
> Frankly, I'm amazed this doesn't crash everywhere, all the time.  But I even added an "assert(newLines)" and it definitely is null.
>
> Not sure what the right fix is here though... anyone?
>
> Thanks,
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng                 sean at rogue-research.com
> Rogue Research                        www.rogue-research.com
> Mac Software Developer              Montréal, Québec, Canada
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>



More information about the vtk-developers mailing list