From 61d598256945dcbcf731001d249065ef8ea29692 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 11 Dec 2022 11:25:26 -0800 Subject: [PATCH] add a test case for #2325 This currently triggers an out-of-bounds read, observable with ASan. --- tests/2325.dot | 6 ++++++ tests/test_regression.py | 15 +++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/2325.dot diff --git a/tests/2325.dot b/tests/2325.dot new file mode 100644 index 000000000..2629fac93 --- /dev/null +++ b/tests/2325.dot @@ -0,0 +1,6 @@ +/// Graph with >63 styles, totalling >128 bytes in one attribute. Note that we +/// do not need the styles to be unique for this test case. + +digraph { + a[style="filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled,filled"]; +} diff --git a/tests/test_regression.py b/tests/test_regression.py index cb7cb2731..946526f98 100644 --- a/tests/test_regression.py +++ b/tests/test_regression.py @@ -2032,6 +2032,21 @@ def test_2307(): assert re.search(r"\bG2_", m.group("url")) is not None, \ "ID G2 was not applied to polygon fill url" +@pytest.mark.xfail() +def test_2325(): + """ + using more than 63 styles and/or more than 128 style bytes should not trigger + an out-of-bounds memory read + https://gitlab.com/graphviz/graphviz/-/issues/2325 + """ + + # locate our associated test case in this directory + input = Path(__file__).parent / "2325.dot" + assert input.exists(), "unexpectedly missing test case" + + # run it through Graphviz + dot("svg", input) + def test_changelog_dates(): """ Check the dates of releases in the changelog are correctly formatted -- 2.40.0