[vtkusers] Critical bug in vtkDepthSortPolyData in VTK7

Bill Lorensen bill.lorensen at gmail.com
Mon Aug 22 11:42:36 EDT 2016


Interestin. I just did a
git grep GetSize
and looked for its use for Polys.

It occurs many times, but mainly in Allocate() statements. This means we
could be over allocating althought I expect that must Polys have been
Squeezed.

I did find these uses:
IO/Xdmf2/vtkXdmfWriter.cxx:        vtkIdType sizev =
pd->GetVerts()->GetSize();
IO/Xdmf2/vtkXdmfWriter.cxx:        vtkIdType sizel =
pd->GetLines()->GetSize();
IO/Xdmf2/vtkXdmfWriter.cxx:        vtkIdType sizep =
pd->GetPolys()->GetSize();
IO/Xdmf2/vtkXdmfWriter.cxx:        vtkIdType sizes =
pd->GetStrips()->GetSize();

Which look like they could be errors.


On Mon, Aug 22, 2016 at 11:09 AM, David Lonie <david.lonie at kitware.com>
wrote:

> MR up: https://gitlab.kitware.com/vtk/vtk/merge_requests/1863
>
> On Mon, Aug 22, 2016 at 10:59 AM, David Lonie <david.lonie at kitware.com>
> wrote:
>
>> Good catch -- looks like a slip up because VTK's APIs are unconventional
>> (GetSize() returns capacity, not number of elements as one would expect).
>> I'll make a merge request for this.
>>
>> Thanks!
>> Dave
>>
>> On Mon, Aug 22, 2016 at 5:42 AM, Pavel Krebs/AMBERG <pkrebs at amberg.cz>
>> wrote:
>>
>>> Hi all,
>>> during moving from vtk 6.2 to vtk 7 (with enabled OpenGL2 backend
>>> rendering) we found serious bug in vtkDepthSortPolyData filter. There is a
>>> problem with generating of output vtkPolyData object. There are usage of
>>> wrong sizes for vtkCellArray for Vert, Lines, Polys,... Instead of real
>>> size the allocated size is used. Later in the rendering request
>>> uninitialised cell ids are used and rendering can crash.
>>> I changed the code like this and it works now. Should be good to fix it
>>> also in VTK7 source code repository.
>>>
>>> int vtkDepthSortPolyData::RequestData(
>>>     vtkInformation *vtkNotUsed(request),
>>>     vtkInformationVector **inputVector,
>>>     vtkInformationVector *outputVector)
>>> {
>>> .
>>> .
>>> .
>>>     vtkIdType *pOutputPolys = NULL;
>>>     if (nPolys)
>>>     {
>>>         vtkCellArray *outputPolyCells = vtkCellArray::New();
>>>         outputPolyCells->SetNumberOfCells(nPolys);
>>>         output->SetPolys(outputPolyCells);
>>>         outputPolyCells->Delete();
>>>         vtkIdTypeArray *outputPolys = outputPolyCells->GetData();
>>> -        outputPolys->SetNumberOfTuples(input->GetPolys()->GetSize());
>>> +        outputPolys->SetNumberOfTuples(input->GetPolys()->GetNumber
>>> OfConnectivityEntries());
>>>         pOutputPolys = outputPolys->GetPointer(0);
>>>     }
>>> .
>>> .
>>> .
>>> }
>>>
>>> Kind regards
>>>
>>> Pavel Krebs
>>> Software Engineer
>>>
>>> AMBERG Engineering Brno, a.s.
>>> Ptašínského 10
>>> 602 00 Brno - Czech Republic
>>>
>>> Phone: +420 541 432 662
>>> E-Mail: pkrebs at amberg.cz
>>> www.amberg.ch/at
>>>
>>> Follow us on: <https://plus.google.com/u/0/115687889920250804536/posts>
>>> <http://www.leica-geosystems.com/facebook>
>>> <http://www.facebook.com/AmbergTech>
>>> <http://www.facebool.com/AmbergTech>
>>> <http://www.linkedin.com/company/amberg-technologies>
>>> <http://www.twitter.com/AmbergTech>
>>> <http://www.youtube.com/user/AmbergTechnologies>
>>>
>>> Visit us at these exhibitions, we are looking forward to meeting you!
>>> <http://hxgnlive.com/en/anaheim> <http://www.retc.org>
>>> Hall 25, booth no. 314                Hall A3, booth no. D3.001
>>> September 20 - 23, 2016                 October 11 - 13, 2016
>>> Berlin, Germany                        Hamburg, Germany
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the VTK FAQ at:
>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>
>>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/vtkusers
>>>
>>>
>>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>


-- 
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160822/ee6f6c1f/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 498 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160822/ee6f6c1f/attachment-0004.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 687 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160822/ee6f6c1f/attachment-0005.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 31529 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160822/ee6f6c1f/attachment-0003.jpe>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 303 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160822/ee6f6c1f/attachment-0006.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 815 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160822/ee6f6c1f/attachment-0004.jpe>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 449 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160822/ee6f6c1f/attachment-0007.gif>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 34523 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160822/ee6f6c1f/attachment-0005.jpe>


More information about the vtkusers mailing list