[vtk-developers] Need help with a few clang analyzer warnings

David Gobbi david.gobbi at gmail.com
Fri Nov 21 12:20:54 EST 2014


Hi Sean,

I can fix vtkCellPicker.cxx by making the code able to handle the
case that property is null.

 - David


On Fri, Nov 21, 2014 at 9:46 AM, Sean McBride <sean at rogue-research.com>
wrote:

> Hi all,
>
> Occasionally, I try to fix some of the hundreds of clang static analyzer
> warnings in VTK.  Some are easy, some are false positives, and some are
> real problems that I don't know how to fix.  I'd like to appeal to you all
> to help fix these 3:
>
> 1)
> file: Common/DataModel/vtkPolyLine.cxx
> method: vtkPolyLine::GenerateSlidingNormals
> lines: 227-237
> problem: dead code.  The "if ( largeRotation )" branch sets "theta" then
> nothing uses it.
>
> 2)
> file: Rendering/Core/vtkCellPicker.cxx
> method: vtkCellPicker::IntersectVolumeWithLine
> line: 691
> problem: the 'property' pointer is initialized to null, and if the
> subsequent 'if' is not entered, it's certainly still null at line 691 and
> dereferenced.
>
> 3)
> file: Common/DataModel/vtkKdTree.cxx
> line: 3188
> method: vtkKdTree::GenerateRepresentationWholeSpace
> problem: the first time through the 'for' loop always does "1 << -1".  You
> can't left shift by a negative count.
>
> I don't want to blindly delete dead code that maybe shouldn't be dead, or
> just throw in null checks, so hopefully someone knows this code!
>
> Cheers,
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng                 sean at rogue-research.com
> Rogue Research                        www.rogue-research.com
> Mac Software Developer              Montréal, Québec, Canada
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20141121/1790c734/attachment.html>


More information about the vtk-developers mailing list