$NetBSD: patch-au,v 1.10 2008/10/12 13:14:39 tron Exp $

--- lib/graph/parser.y.orig	2007-09-07 13:05:44.000000000 +0100
+++ lib/graph/parser.y	2008-10-12 13:46:18.000000000 +0100
@@ -31,7 +31,8 @@
 static Agnode_t		*N;
 static Agedge_t		*E;
 static objstack_t	*SP;
-static Agraph_t		*Gstack[32];
+#define GSTACK_SIZE 64
+static Agraph_t		*Gstack[64];
 static int			GSP;
 
 static void subgraph_warn (void)
@@ -44,6 +45,9 @@
 
 static void push_subg(Agraph_t *g)
 {
+	if (GSP >= GSTACK_SIZE) {
+		agerr (AGERR, "Gstack overflow in graph parser\n"); exit(1);
+	}
 	G = Gstack[GSP++] = g;
 }
 
