From bd97cff688f7a7b85b6f1262e14eb1cac0862fcd Mon Sep 17 00:00:00 2001 From: "Emden R. Gansner" Date: Fri, 29 Dec 2017 16:42:51 -0500 Subject: [PATCH] Avoid integer overflow problem. --- lib/dotgen/mincross.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dotgen/mincross.c b/lib/dotgen/mincross.c index 44ee2f1b9..d15616683 100644 --- a/lib/dotgen/mincross.c +++ b/lib/dotgen/mincross.c @@ -1847,7 +1847,7 @@ static boolean medians(graph_t * g, int r0, int r1) if (lspan == rspan) ND_mval(n) = (list[lm] + list[rm]) / 2; else { - int w = list[lm] * rspan + list[rm] * lspan; + double w = list[lm] * (double)rspan + list[rm] * (double)lspan; ND_mval(n) = w / (lspan + rspan); } } -- 2.40.0