From: Matthew Fernandez Date: Fri, 22 Apr 2022 04:53:41 +0000 (-0700) Subject: dot2gxl: fix crashes when given an empty node id X-Git-Tag: 4.0.0~76^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=153797a64cab66f8d27e271ce0c03c2afbdc37b3;p=graphviz dot2gxl: fix crashes when given an empty node id An empty node id is now treated as if id was missing altogether. Gitlab: fixes #2092 --- diff --git a/CHANGELOG.md b/CHANGELOG.md index bf9f93f5a..e89cfb043 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - gvpr index function produces wrong results #2211. This was a regression in Graphviz 2.47.0. - Error on more than 128 cluster subgraphs #2080 +- `dot2gxl` no longer crashes on input `` #2092 ### Removed diff --git a/cmd/tools/gxl2gv.c b/cmd/tools/gxl2gv.c index 8d4364afa..47cb165a6 100644 --- a/cmd/tools/gxl2gv.c +++ b/cmd/tools/gxl2gv.c @@ -485,9 +485,11 @@ startElementHandler(void *userData, const char *name, const char **atts) const char *attrname; attrname = atts[pos]; - bind_node(attrname); + if (attrname != NULL && strcmp(attrname, "") != 0) { + bind_node(attrname); - pushString(&ud->elements, attrname); + pushString(&ud->elements, attrname); + } } } else if (strcmp(name, "edge") == 0) { diff --git a/rtest/test_regression.py b/rtest/test_regression.py index 09f693748..197cfe174 100644 --- a/rtest/test_regression.py +++ b/rtest/test_regression.py @@ -1228,7 +1228,6 @@ def test_2089_2(): @pytest.mark.skipif(shutil.which("dot2gxl") is None, reason="dot2gxl not available") -@pytest.mark.xfail() # FIXME def test_2092(): """ an empty node ID should not cause a dot2gxl NULL pointer dereference