]> granicus.if.org Git - graphviz/commitdiff
don't clean away Agraphinfo_t in layout specific cleanups
authorMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Tue, 12 Jul 2022 13:11:25 +0000 (15:11 +0200)
committerMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Mon, 25 Jul 2022 18:24:49 +0000 (20:24 +0200)
This cleanup is since 2b3b37c47244f57a9690bff8fb92f77d17ec616c handled
by the general `graph_cleanup` function.

This information is since 44b02b91bd156cb832894fb4948bf4bc75ab27cb
needed by the general layout cleanup function that runs after the
layout-specific cleanup.

This problem was fixed for root graphs in commit
c55b546e3965a8dfd2a66763961c4a8003e433bf, but not for subgraph layout.

This fixes a heap-buffer-overflow detected by ASan in the
test_neatopack test, which now runs without failures.

This commit also reverts commit
291b7a40f742551797e5681acbb8f5662c084822 since the
dot.demo/neatopack.c example now runs without failures.

Fixes https://gitlab.com/graphviz/graphviz/-/issues/1800.

CHANGELOG.md
lib/circogen/circularinit.c
lib/dotgen/dotinit.c
lib/fdpgen/fdpinit.c
lib/neatogen/neatoinit.c
lib/patchwork/patchworkinit.c
lib/twopigen/twopiinit.c
tests/CMakeLists.txt
tests/test_examples.py

index 73632a20d1c3f9f31f50602cb5a22917f0828a35..7f07228e5e43aee4b640a3036d04e77e6f2c79c5 100644 (file)
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - smyrna: incorrect tokenization in frmobjectui.c:set_attr_object_type #2259
 - [Dot] Record shape+UTF+" | "=Eats spaces. #925
 - Memory leak in osage
+- Segmentation fault when running test example neatopack.c #1800
 
 ## [5.0.0] – 2022-07-07
 
index 01f07c4e086af3eb1d925fe1c98297049457136d..7c6fd208af8eb21e38370f28052ebc5af281393d 100644 (file)
@@ -273,6 +273,4 @@ void circo_cleanup(graph_t * g)
        gv_cleanup_node(n);
     }
     free(GD_neato_nlist(g));
-    if (g != agroot(g)) 
-       agclean (g,AGRAPH,"Agraphinfo_t");
 }
index f9b24f121e49dca1fb4b34e1823e401fb2d1534d..a938f429a75eb28eff946b306a6317150bf5fe08 100644 (file)
@@ -157,7 +157,6 @@ dot_cleanup_graph(graph_t * g)
     }
     if (g != agroot(g)) {
        free_label (GD_label(g));
-       agdelrec(g,"Agraphinfo_t");
     }
 }
 
index 7de124237b971c79bb2406c6aa7d162724fe2d34..e76a12d12739928db28fae125d123dc54d91ea5e 100644 (file)
@@ -125,8 +125,6 @@ static void cleanup_subgs(graph_t * g)
        cleanup_subgs(subg);
     }
     free (GD_clust(g));
-    if (g != agroot(g))
-       agdelrec(g, "Agraphinfo_t");                            
 }
 
 static void fdp_cleanup_graph(graph_t * g)
index ec1816c024df7b949ad31bf4d5d12a3f040574d4..d23c41227403fcd35928c722a8b5292ab1831bb0 100644 (file)
@@ -135,8 +135,6 @@ static void neato_cleanup_graph(graph_t * g)
        free_scan_graph(g);
        free(GD_clust(g));
     }
-    if (g != agroot(g))
-        agclean(g, AGRAPH , "Agraphinfo_t");
 }
 
 void neato_cleanup(graph_t * g)
index 799be346aeae98b3971add48c4254a8b0c3e16af..481fb15679a4f4dd2cb43c7175f6b037d2aac196 100644 (file)
@@ -152,8 +152,6 @@ void patchwork_layout(Agraph_t *g)
 static void patchwork_cleanup_graph(graph_t * g)
 {
     free(GD_neato_nlist(g));
-    if (g != agroot(g))
-        agclean(g, AGRAPH , "Agraphinfo_t");
 }
 
 void patchwork_cleanup(graph_t * g)
index 97695a898f392914c50132559ba935ec31ff2115..16eecda3b22ce13578e7a11dc209b359241eb361 100644 (file)
@@ -170,8 +170,6 @@ void twopi_layout(Agraph_t * g)
 static void twopi_cleanup_graph(graph_t * g)
 {
     free(GD_neato_nlist(g));
-    if (g != agroot(g))
-       agclean(g,AGRAPH,"Agraphinfo_t");
 }
 
 /* twopi_cleanup:
index c67f348123d96a9571d39d94b426231c672a61d8..d153f8a93ccac145d9121a2a518b483265489c77 100644 (file)
@@ -73,6 +73,5 @@ CREATE_TEST(GVContext_render_svg)
 CREATE_TEST(GVLayout_construction)
 CREATE_TEST(GVLayout_render)
 CREATE_TEST(neatopack)
-set_tests_properties(test_neatopack PROPERTIES WILL_FAIL true)
 CREATE_TEST(simple)
 CREATE_TEST(subgraphs)
index 6f4fecb94bf8bf8e7d39021e0e8fb0c1f76173dc..f82aa5769806c98026f12ee3025d7bcbb66ec0a7 100644 (file)
@@ -27,11 +27,6 @@ def test_compile_example(src):
 
   libs = ["cgraph", "gvc"]
 
-  # FIXME: Remove skip of execution of neatopack.c example when
-  # https://gitlab.com/graphviz/graphviz/-/issues/1800 has been fixed
-  if src == "neatopack.c":
-    pytest.skip("Executing neatopack gives segmentation fault (#1800)")
-
   # run the example
   args = ["-Kneato"] if src in ["demo.c", "dot.c"] else []