UBSan not fully applied in CI
There are a pair of CI pipes, ubuntu21.04-cmake-ASan-*
and ubuntu21-10-cmake-ASan-*
, that run the CMake build and ctest with ASan and UBSan enabled. While looking at something else in this area, I noticed that neither the CMake support for these sanitizers nor .gitlab-ci.yml uses -fno-sanitize-recover=undefined
. Without this, UBSan warnings display an error but do not abort program execution.
Maybe the above was already known but it was a surprise to me. Enabling -fno-sanitize-recover=undefined
reveals that the #1906 (closed) test case triggers an integer overflow:
def test_1906():
"""
graphs that cause an overflow during rectangle calculation should result in
a layout error
https://gitlab.com/graphviz/graphviz/-/issues/1906
"""
# one of the rtest graphs is sufficient to provoke this
input = Path(__file__).parent / "graphs/root.gv"
assert input.exists(), "unexpectedly missing test case"
# use Circo to translate it to DOT
with subprocess.Popen(["dot", "-Kcirco", "-Tgv", "-o", os.devnull, input],
stderr=subprocess.PIPE, universal_newlines=True) as p:
_, stderr = p.communicate()
assert p.returncode != 0, "graph that generates overflow was accepted"
> assert "area too large" in stderr, "missing/incorrect error message"
E AssertionError: missing/incorrect error message
E assert 'area too large' in "/builds/smattr/graphviz/lib/label/xlabels.c:35:15: runtime error: signed integer overflow: -1884993080 - 1219985688 cannot be represented in type 'int'\n"
/builds/smattr/graphviz/rtest/test_regression.py:946: AssertionError