- x11 back end segfaults if display is unavailable #1776
- Repeated file read gives different results with libcgraph #1767
- typo in cmd/gvpr/lib/clustg #1781
+- Segfault in dot #1783
## [2.44.1] - 2020-06-29
* because mincross may compare nodes in different clusters.
*/
+#include <assert.h>
#include "dot.h"
+#include <limits.h>
+#include <stdlib.h>
/* #define DEBUG */
#define MARK(v) (ND_mark(v))
{
int t;
t = table[endpoint_class(agtail(e))][endpoint_class(aghead(e))];
+
+ /* check whether the upcoming computation will overflow */
+ assert(t >= 0);
+ if (INT_MAX / t < ED_weight(e)) {
+ agerr(AGERR, "overflow when calculating virtual weight of edge\n");
+ exit(EXIT_FAILURE);
+ }
+
ED_weight(e) *= t;
}
import pytest
import platform
import shutil
+import signal
import subprocess
import os
import re
'cluster_1 contains 1 nodes\n' \
'cluster_2 contains 3 nodes\n' \
'cluster_3 contains 3 nodes\n'
+
+def test_1783():
+ '''
+ Graphviz should not segfault when passed large edge weights
+ https://gitlab.com/graphviz/graphviz/-/issues/1783
+ '''
+
+ # locate our associated test case in this directory
+ input = os.path.join(os.path.dirname(__file__), '1783.dot')
+ assert os.path.exists(input), 'unexpectedly missing test case'
+
+ # run Graphviz with this input
+ ret = subprocess.call(['dot', '-Tsvg', '-o', os.devnull, input])
+
+ assert ret != 0, 'Graphviz accepted illegal edge weight'
+
+ assert ret != -signal.SIGSEGV, 'Graphviz segfaulted'