- buffer overflow in fdpgen
- Crashes by VRML output when current directory is not writable #793
- Segmentation fault when newrank=true #1221
+- sfdp craches #236
+- fdp segmentation fault with GK=0 #1290
+- fdp crash #1865
## [2.44.1] - 2020-06-29
static int write_canonstr(Agraph_t * g, iochan_t * ofile, char *str)
{
- return _write_canonstr(g, ofile, str, TRUE);
+ char *s;
+ int r;
+
+ /* str may not have been allocated by agstrdup, so we first need to turn it
+ * into a valid refstr
+ */
+ s = agstrdup(g, str);
+
+ r = _write_canonstr(g, ofile, s, TRUE);
+
+ agstrfree(g, s);
+ return r;
}
static int write_dict(Agraph_t * g, iochan_t * ofile, char *name,
# generate a multipage PS file from this input
subprocess.check_call(['dot', '-Tps', '-o', os.devnull, input])
+@pytest.mark.skipif(shutil.which('fdp') is None, reason='fdp not available')
+def test_1865():
+ '''
+ fdp should not read out of bounds when processing node names
+ https://gitlab.com/graphviz/graphviz/-/issues/1865
+ Note, the crash this test tries to provoke may only occur when run under
+ Address Sanitizer or Valgrind
+ '''
+
+ # locate our associated test case in this directory
+ input = os.path.join(os.path.dirname(__file__), '1865.dot')
+ assert os.path.exists(input), 'unexpectedly missing test case'
+
+ # fdp should not crash when processing this file
+ subprocess.check_call(['fdp', '-o', os.devnull, input])
+
# root directory of this checkout
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))