Cannot build cluster example as SVG, the graphical size is huge

TL;DR on Linux Alpine 3.18, graphviz 8.0.5 and 8.1.0 produce an insanely tall SVG when encountering clusters with >1 node.

Steps to reproduce

Put cluster.dot into the current directory You can run alpine with e.g.

docker run -it --rm -v $PWD:/mnt alpine:3.18 /bin/ash

From inside, install graphviz with

apk add graphviz
cd /mnt
dot -Tsvg cluster.dot > cluster.svg

where cluster.dot is as follows (take from the documentation):

digraph G {
	fontname="Helvetica,Arial,sans-serif"
	node [fontname="Helvetica,Arial,sans-serif"]
	edge [fontname="Helvetica,Arial,sans-serif"]

	subgraph cluster_0 {
		style=filled;
		color=lightgrey;
		node [style=filled,color=white];
		a0 -> a1 -> a2 -> a3;
		label = "process #1";
	}

	subgraph cluster_1 {
		node [style=filled];
		b0 -> b1 -> b2 -> b3;
		label = "process #2";
		color=blue
	}
	start -> a0;
	start -> b0;
	a1 -> b3;
	b2 -> a3;
	a3 -> a0;
	a3 -> end;
	b3 -> end;

	start [shape=Mdiamond];
	end [shape=Msquare];
}

Expected Behaviour

image

Actual Behaviour

I can't even take a screenshot of the image, the size computed by chromium is 300x10826600 pixels when running on graphviz 8.0.5. The height of the svg is huge, I'm attaching the problematic output for each of the versions I tested:

cluster-8.0.5.svg cluster-8.1.0.svg

OS Version

Linux Alpine 3.18. We use it as part of our CI/CD setup.

Graphviz Version

Here is the list of versions that I tried:

dot - graphviz version 8.0.5 (20230430.1635)
dot - graphviz version 8.1.0 (20230707.0739)

On alpine 3.17 with graphviz 7.0.5 the issue does not occur.

Additional information

This occurs with any cluster graph with more than one node inside.

Edited by Pietro Saccardi