]> granicus.if.org Git - graphviz/commitdiff
fix: print index instead of pointer value in debugging message
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 9 May 2020 00:16:18 +0000 (17:16 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 9 May 2020 00:16:18 +0000 (17:16 -0700)
The .v and .av members of the structs being used here are node_t**s. So the
addition of an integer results in a node_t**. This does not seem like what was
intended to be printed here, but rather the integer value being added. This
issue was found by adding __attribute__((format(printf, 2, 3))) to agerr() and
then using compiler flag -Werror=format.

lib/dotgen/mincross.c

index c7c498541b2b27745da8d831315cfca06752c79f..7d5f73ae9f9a75cda4a472621342fd37dbcad730 100644 (file)
@@ -1365,7 +1365,7 @@ void install_in_rank(graph_t * g, node_t * n)
     if (GD_rank(g)[r].v + ND_order(n) >
        GD_rank(g)[r].av + GD_rank(Root)[r].an) {
        agerr(AGERR, "install_in_rank, line %d: GD_rank(g)[%d].v + ND_order(%s) [%d] > GD_rank(g)[%d].av + GD_rank(Root)[%d].an [%d]\n",
-             __LINE__, r, agnameof(n),GD_rank(g)[r].v + ND_order(n), r, r, GD_rank(g)[r].av+GD_rank(Root)[r].an);
+             __LINE__, r, agnameof(n),ND_order(n), r, r, GD_rank(Root)[r].an);
        return;
     }
 }