[vtk-developers] Help with vtkDataSetSurfaceFilter.cxx:2144...

Berk Geveci berk.geveci at kitware.com
Mon Dec 16 16:36:14 EST 2013


Hi Sean,

I looked into this. It may actually be a false positive. That code is a
little tricky. Even though ptArray is 4 big in the declaration of the
class, the code actually reinterprets a byte array as a pointer to
vtkFastGeomQuadStruct
after allocating the right size. It essentially allocates
sizeof(vtkFastGeomQuadStruct)
+ sizeof(vtkIdType) * (numPts - 4). So there is the right extra space as
padding and things should work as long as ptArray is the last member of the
struct. However, the sanitizer may rightfully not like this.  Can you point
out which tests are causing the warning so I can track this down more? There
is a bug in there but it is very unlikely to occur. Even if it is a false
positive, we may still want to fix it just to have a clean sanitizer output.

-berk


On Fri, Mar 8, 2013 at 3:50 PM, Sean McBride <sean at rogue-research.com>wrote:

> Hi folks,
>
> On 18 different VTK tests, clang's sanitizer complains about:
>
> Filters/Geometry/vtkDataSetSurfaceFilter.cxx:2144:7: runtime error: index
> 4 out of bounds for type 'vtkIdType [4]'
>
> I believe it is right to complain.  When 'numPts' is > 4, the write to
> 'ptArray' goes past the end.  The read of 'tab' is ok, as it is allocated
> to be big enough:
>
> vtkIdType* tab = new vtkIdType[numPts];
>
> But AFAICT, 'ptArray' is always 4 items big, despite the existence of the
> sizeofFastQuad() function and the comment "actually a variable length
> array.  MUST be last"
>
> Someone out there know this code?
>
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20131216/66b4b048/attachment.html>


More information about the vtk-developers mailing list