Number: 22
Title: core dump for "rank = min"
Submitter: Bob Lied
Date: Thu May 31 09:31:15 2001
Subsys: Dot
Version: 1.7.6
System: *-*-
Severity: minor
Problem:
dot dumps core on some graphs where rank=min is specified. Tracked this to a wrong null pointer check in dotneato/dotgen/dot.c, minmax_edges().

See below for the patch I used

Sorry for the length of the example
Input:

digraph G {
        rankdir=LR;
node [shape=box];
        size = "7.5,10.0";
ratio = "fill";
center =1;

        /* Node Definitions */


        dc1 [shape=plaintext,label="DC 1"];
        dc10 [shape=plaintext,label="DC 10"];
        dc100 [shape=plaintext,label="DC 100"];

        { rank = same; "dc1"; "dc10"; "dc100"; }

        /* Link Definitions */

        /* Marking Unused Dialing Plans */

        no_dc [shape=plaintext,label="NOTHING"];
        { rank = min; "no_dc"; }
}
Fix:
dotneato/dotgen/rank.c in function minmax_edges()

    srclen = sinklen = 0;
    if ((g->u.maxset == NULL) && (g->u.minset == NULL)) return;
#ifdef RL_2001_05_30_BUGFIX
    /* We returned for both pointers NULL, but not if either one. */
    g->u.minset = UF_find(g->u.minset);
    g->u.maxset = UF_find(g->u.maxset);
#else
    if ( g->u.minset != 0 ) g->u.minset = UF_find(g->u.minset);
    if ( g->u.maxset != 0 ) g->u.maxset = UF_find(g->u.maxset);
#endif

Owner: ellson
Status: Fixed