]> granicus.if.org Git - graphviz/commit
twopigen: layout: fix heap-buffer-overflow by storing dimension in root graph
authorMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Mon, 18 Jul 2022 13:02:59 +0000 (15:02 +0200)
committerMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Mon, 25 Jul 2022 18:24:49 +0000 (20:24 +0200)
commit434ff46f2486762b2cea33439884bf2151110dfe
tree1fb882d350ce164c9388eb3ae92ee2b224b5b12e
parentb2ea962f31e4c70fe94f256bf39236598824dd6a
twopigen: layout: fix heap-buffer-overflow by storing dimension in root graph

The layout allocates memory based on the dimension of the root graph,
but since the dimension was stored in the subgraph and the dimension
in the root graph defaulted to zero, too little memory was allocated.

An alternative solution would have been to use the dimension of the
subgraph, but this had other implications and the chosen solution is
the same as what the other two layout engines supporting the dim
attribute (neato and sfdp) use. Twopi always uses two dimensions.

This fixes the last memory issue detected by ASan in the
test_subgraph_layout test, which now runs without failures.
CHANGELOG.md
lib/twopigen/twopiinit.c
tests/CMakeLists.txt