From: Matthew Fernandez Date: Sun, 27 Sep 2020 20:54:06 +0000 (-0700) Subject: check for failure of push() in dfs() in libpack X-Git-Tag: 2.46.0~20^2^2~54^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4365490a0a10a4da1d4fc756e55f91aa7cb87318;p=graphviz check for failure of push() in dfs() in libpack Related to #1801. --- diff --git a/lib/pack/ccomps.c b/lib/pack/ccomps.c index a8a1d3147..4f9ac80e8 100644 --- a/lib/pack/ccomps.c +++ b/lib/pack/ccomps.c @@ -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;