Number: 33
Title: subgraph cluster labels cause core dump
Submitter: Philip Gwyn
Date: Sat Jul 7 03:37:24 2001
Subsys: Dot
Version: 1.7.6
System: x86-Linux-2.2.18
Severity: major
Problem:
dot has a segfault when I put a label="" inside a subgraph cluseter.

After some kwalitee time with gdb, I isolated the problem in dotneato/dotgen/rank.c, the function collapse_sets() was using a Agraph_t (subg) to find the size of the cluster. This struct didn't have subg->u.drawing set up properly, so that when we got all the way down to actualwidth(), it was trying to find the width of the lable... and dumping core.

Here's a small patch that seems to fix the problem.

-philip
Input:

digraph JAAS {
    fontname=arial;
    fontsize=20;
    subgraph cluster0 {
	label="Foo";
        JOC [ label="JAAS" ];
    };
}
Fix:

--- gv1.7.6/dotneato/dotgen/rank.c  Wed May  2 15:00:46 2001
+++ gv1.7.6.PG/dotneato/dotgen/rank.c   Sat Jul  7 03:29:09 2001
@@ -95,6 +95,7 @@
    graph_t     *mg,*subg;
    node_t      *mn,*n;
    edge_t      *me;
+   layout_t    *tl;

mg = g->meta_node->graph; for (me = agfstout(mg,g->meta_node); me; me = agnxtout(mg,me)) { @@ -103,7 +104,14 @@

c = rank_set_class(subg); if (c) { - if ((c == CLUSTER) && CL_type == LOCAL) collapse_cluster(g,subg); + if ((c == CLUSTER) && CL_type == LOCAL) { + tl=subg->u.drawing; + if(subg->u.drawing==NULL) + subg->u.drawing=g->u.drawing; + collapse_cluster(g,subg); + subg->u.drawing=tl; + + } else collapse_rankset(g,subg,c); }


Owner: north
Status: Fixed (8 Feb 2002)