]> granicus.if.org Git - graphviz/commitdiff
Fix error in ccomps where user specifies far too many components.
authorEmden Gansner <erg@research.att.com>
Wed, 14 Dec 2011 17:35:25 +0000 (12:35 -0500)
committerEmden Gansner <erg@research.att.com>
Wed, 14 Dec 2011 17:35:25 +0000 (12:35 -0500)
cmd/tools/ccomps.c

index 3d74fe52385e17ddd1c311f27b655d2381ce3fe5..d51c3c74cddb2999e20077cc406020fc05aa727c 100644 (file)
@@ -582,8 +582,10 @@ printSorted (Agraph_t* root, int c_cnt)
                sortIndex, agnameof(root));
            return;
        }
-       if (sortFinal >= sortIndex)
+       if (sortFinal >= sortIndex) {
            endi = sortFinal;
+           if (endi >= c_cnt) endi = c_cnt-1;
+       }
        else
            endi = c_cnt-1;
         for (i = sortIndex; i <= endi ; i++) {