#4505: Boyer's planarity code mishandles graphs with no edges
--------------------------+-------------------------------------------------
 Reporter:  jason         |       Owner:  rlm     
     Type:  defect        |      Status:  new     
 Priority:  major         |   Milestone:  sage-3.2
Component:  graph theory  |    Keywords:          
--------------------------+-------------------------------------------------
 We get random segfaults from the planarity code because it doesn't seem to
 handle graphs with no edges properly.

 The segfaults occur in these lines from sage/graphs/planarity/graphEmbed.c

 {{{
         Jfirst = theGraph->G[I].link[1];

         if (theGraph->G[Jfirst].type == EDGE_FORWARD)
         {

             /* Find the end of the forward edge list */

             Jnext = Jfirst;
             while (theGraph->G[Jnext].type == EDGE_FORWARD)
 }}}

 The problem is that when there are no edges, theGraph->G[I].link[1] is -1,
 Jfirst is -1.  If the random value at theGraph->G[-1].type is 2
 (EDGE_FORWARD), then the code in the if block is executed and we get a
 segfault when trying to access fields inside the if block.

 For now, this patch skirts the issue by checking for the case of no edges
 explicitly before Boyer's code is called.

 I am emailing John Boyer about this as well.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4505>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to