[vtk-developers] RE: RE: Help with vtkLineRepresentationTest1 test

David Cole dlrdave at aol.com
Wed Mar 20 17:16:11 EDT 2013


Except make it an “||” instead of an “&&”...

 


From: David Cole
Sent: ‎March‎ ‎20‎, ‎2013 ‎5‎:‎15‎ ‎PM
To: vtk-developers at vtk.org; Sean McBride
Subject: [vtk-developers] RE: Help with vtkLineRepresentationTest1 test



There’s already this code:

    if (size == NULL)
      {
      return;
      }


Why not just add another similar block?

    if (size[0] == 0 && size[1] == 0)


      {
      return;
      }


I bet all of those tests that assert go through that same code again later after the window really does have a size, and the correct result is used way after this “failure” is presently occurring...



D



From: Sean McBride
Sent: ‎March‎ ‎20‎, ‎2013 ‎5‎:‎04‎ ‎PM
To: vtk-developers at vtk.org
Subject: [vtk-developers] Help with vtkLineRepresentationTest1 test


Hi all,

The test 'vtkInteractionWidgetsCxx-vtkLineRepresentationTest1' divides by 0, thus creating a (double) NaN, which it then later tries to convert to float, which is undefined behaviour[1].

The divide-by-zero happens in vtkViewport::DisplayToView() because size[0] and size[1] are zero, which I'm thinking they probably shouldn't be.  Backtrace:

#0  vtkViewport::DisplayToView (this=0x10ff51fc0) at VTK/Rendering/Core/vtkViewport.cxx:209
#1  vtkViewport::DisplayToWorld (this=0x10ff51fc0) at vtkViewport.h:169
#2  vtkInteractorObserver::ComputeDisplayToWorld (ren=0x10ff51fc0, x=-2.5, y=-2.5, z=0.99000990000000011, worldPt=0x7fff5fbfba40) at VTK/Rendering/Core/vtkInteractorObserver.cxx:268
#3  vtkWidgetRepresentation::SizeHandlesInPixels (this=0x10ff21900, factor=1.3500000000000001, pos=0x10ff37a98) at VTK/Interaction/Widgets/vtkWidgetRepresentation.cxx:194
#4  vtkLineRepresentation::SizeHandles (this=0x10ff21900) at VTK/Interaction/Widgets/vtkLineRepresentation.cxx:673
#5  vtkLineRepresentation::BuildRepresentation (this=0x10ff21900) at VTK/Interaction/Widgets/vtkLineRepresentation.cxx:738
#6  vtkLineRepresentationTest1 () at VTK/Interaction/Widgets/Testing/Cxx/vtkLineRepresentationTest1.cxx:21
#7  main (ac=7, av=0x7fff5fbff7b0) at VTK-big-bin/Interaction/Widgets/Testing/Cxx/CxxTests.cxx:587

You can easily reproduce this with any compiler if you add:

    assert(sizex > 0);
    assert(sizey > 0);

to vtkViewport::DisplayToView().  In fact doing so results in 6 different tests asserting.

I don't know how to address this... any thoughts?

[1] or at least sorta undefined:
<http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-March/028596.html>

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/20130320/75680073/attachment.html>


More information about the vtk-developers mailing list