<div dir="ltr">Hi Sean,<div><br></div><div>I looked into this. It may actually be a false positive. That code is a little tricky. Even though <span style="font-family:arial,sans-serif;font-size:13px">ptArray is 4 big in the declaration of the class, the code actually reinterprets a byte array as a pointer to </span><font face="arial, sans-serif">vtkFastGeomQuadStruct after allocating the right size. It essentially allocates sizeof(</font><span style="font-family:arial,sans-serif">vtkFastGeomQuadStruct) + sizeof(vtkIdType) * (numPts - 4).</span><span style="font-family:arial,sans-serif"> 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. </span><span style="font-family:arial,sans-serif"> Can you point out which tests are causing the warning so I can track this down more? </span><span style="font-family:arial,sans-serif">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.</span></div>

<div><span style="font-family:arial,sans-serif"><br></span></div><div><span style="font-family:arial,sans-serif">-berk</span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Mar 8, 2013 at 3:50 PM, Sean McBride <span dir="ltr"><<a href="mailto:sean@rogue-research.com" target="_blank">sean@rogue-research.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi folks,<br>
<br>
On 18 different VTK tests, clang's sanitizer complains about:<br>
<br>
Filters/Geometry/vtkDataSetSurfaceFilter.cxx:2144:7: runtime error: index 4 out of bounds for type 'vtkIdType [4]'<br>
<br>
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:<br>
<br>
vtkIdType* tab = new vtkIdType[numPts];<br>
<br>
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"<br>
<br>
Someone out there know this code?<br>
<br>
Thanks,<br>
<br>
--<br>
____________________________________________________________<br>
Sean McBride, B. Eng                 <a href="mailto:sean@rogue-research.com">sean@rogue-research.com</a><br>
Rogue Research                        <a href="http://www.rogue-research.com" target="_blank">www.rogue-research.com</a><br>
Mac Software Developer              Montréal, Québec, Canada<br>
<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
</blockquote></div><br></div>