]> granicus.if.org Git - graphviz/commitdiff
introduce an assertion on rank consistency
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 31 Oct 2020 23:01:31 +0000 (16:01 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 7 Nov 2020 01:50:50 +0000 (17:50 -0800)
Related to #1221.

lib/dotgen/cluster.c

index c711f1b760e8e034f94455f7fefaf1f59989cd71..892ac092c29ec98918d60fc377e318bfdd651f35 100644 (file)
@@ -11,7 +11,7 @@
  * Contributors: See CVS logs. Details at http://www.graphviz.org/
  *************************************************************************/
 
-
+#include <assert.h>
 #include <dotgen/dot.h>
 
 static node_t*
@@ -233,6 +233,8 @@ merge_ranks(graph_t * subg)
     node_t *v;
     graph_t *root;
 
+    assert(GD_minrank(subg) <= GD_maxrank(subg) && "corrupted rank bounds");
+
     root = dot_root(subg);
     if (GD_minrank(subg) > 0)
        GD_rank(root)[GD_minrank(subg) - 1].valid = FALSE;