]> granicus.if.org Git - graphviz/commitdiff
add a test case for #2325
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 11 Dec 2022 19:25:26 +0000 (11:25 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 14 Dec 2022 01:05:42 +0000 (17:05 -0800)
This currently triggers an out-of-bounds read, observable with ASan.

tests/2325.dot [new file with mode: 0644]
tests/test_regression.py

diff --git a/tests/2325.dot b/tests/2325.dot
new file mode 100644 (file)
index 0000000..2629fac
--- /dev/null
@@ -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"];
+}
index cb7cb273146817d0c99da4aa1686631f16734657..946526f98b28bc1760ea534623ca156798f6c32f 100644 (file)
@@ -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