]> granicus.if.org Git - graphviz/commitdiff
check for failure of push() in dfs() in libpack
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 27 Sep 2020 20:54:06 +0000 (13:54 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 4 Oct 2020 18:51:54 +0000 (11:51 -0700)
Related to #1801.

lib/pack/ccomps.c

index a8a1d3147ce82e03112fa1e2fb605ef9cb3ebb99..4f9ac80e83df5bf1a97da5928e8531afa8937fee 100644 (file)
@@ -119,7 +119,9 @@ static size_t dfs(Agraph_t * g, Agnode_t * n, void *state, stk_t* stk)
     Agnode_t *other;
     size_t cnt = 0;
 
-    push (stk, n);
+    if (push (stk, n) != 0) {
+       return SIZE_MAX;
+    }
     while ((n = pop(stk))) {
        cnt++;
        if (stk->actionfn) stk->actionfn(n, state);
@@ -127,7 +129,9 @@ static size_t dfs(Agraph_t * g, Agnode_t * n, void *state, stk_t* stk)
            if ((other = agtail(e)) == n)
                other = aghead(e);
             if (!MARKED(stk,other))
-                push(stk, other);
+                if (push(stk, other) != 0) {
+                    return SIZE_MAX;
+                }
         }
     }
     return cnt;