From: Matthew Fernandez Date: Sat, 25 Sep 2021 19:27:36 +0000 (-0700) Subject: gv2gml: fix attribute escaping X-Git-Tag: 2.49.2~28^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7d607090a00e03d6809d61755dbbe39a003b875c;p=graphviz gv2gml: fix attribute escaping When processing characters in attribute values that should be escaped (e.g. `"`), `gv2gml` would emit these as-is, resulting in invalid GML output. Such attribute values are now correctly XML-escaped. Fixes #1276. --- diff --git a/CHANGELOG.md b/CHANGELOG.md index a715d35a6..00b6a6a77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Msys experimental packages are included in release artifacts #2130 - CMake build system incorrectly aliases gv2gml to gml2gv #2131 +- Gv2gml Doesn't escape quotes in attributes #1276 ## [2.49.1] – 2021-09-22 diff --git a/cmd/tools/gv2gml.c b/cmd/tools/gv2gml.c index 716ae9e07..788db3afa 100644 --- a/cmd/tools/gv2gml.c +++ b/cmd/tools/gv2gml.c @@ -24,6 +24,8 @@ #include #include +#include +#include #include #include @@ -222,7 +224,7 @@ emitAttr (char* name, char* value, FILE* outFile, int ix) if (isNumber (value)) fprintf (outFile, "%s %s\n", name, value); else - fprintf (outFile, "%s \"%s\"\n", name, value); + fprintf (outFile, "%s \"%s\"\n", name, xml_string(value)); } /* node attributes: diff --git a/rtest/test_regression.py b/rtest/test_regression.py index f48262be0..6b4ac674d 100644 --- a/rtest/test_regression.py +++ b/rtest/test_regression.py @@ -346,7 +346,6 @@ def test_1221(): @pytest.mark.skipif(shutil.which("gv2gml") is None, reason="gv2gml not available") -@pytest.mark.xfail(strict=True) def test_1276(): """ quotes within a label should be escaped in translation to GML