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

David Cole dlrdave at aol.com
Fri Mar 8 20:37:35 EST 2013


I looked at the code, too. I agree with David Gobbi.

 

Change the newLines to newPolys. Probably a copy/paste/forgot-to-change-variable-name error...

 

Making it static would be a bonus, but not required in this particular instance to fix the problem at hand.

 


From: David Gobbi
Sent: ‎March‎ ‎8‎, ‎2013 ‎7‎:‎38‎ ‎PM
To: Sean McBride
CC: vtk-developers at vtk.org
Subject: Re: [vtk-developers] Help with vtkImageDataGeometryFilter.cxx:250...


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
>
_______________________________________________
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20130309/3176ba57/attachment.html>


More information about the vtk-developers mailing list