gbranden pushed a commit to branch master
in repository groff.
commit 1b721545d4d81ab0e446ac6a756ccabd0414e889
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Apr 11 05:01:04 2026 -0500
[groff]: Validate error path.
...in src/libs/libgroff/symbol.cpp:symbol::symbol.
* src/roff/groff/tests/error-overflow-symbol-table.sh: Do it.
* src/roff/groff/groff.am (groff_TESTS): Run test.
---
ChangeLog | 8 +++++
src/roff/groff/groff.am | 1 +
.../groff/tests/error-overflow-symbol-table.sh | 38 ++++++++++++++++++++++
3 files changed, 47 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index f827356a1..dfe02dcf7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2026-04-11 G. Branden Robinson <[email protected]>
+
+ [groff]: Validate error path in
+ src/libs/libgroff/symbol.cpp:symbol::symbol.
+
+ * src/roff/groff/tests/error-overflow-symbol-table.sh: Do it.
+ * src/roff/groff/groff.am (groff_TESTS): Run test.
+
2026-04-10 G. Branden Robinson <[email protected]>
* src/roff/troff/env.cpp
diff --git a/src/roff/groff/groff.am b/src/roff/groff/groff.am
index b5d77bc63..65c60376c 100644
--- a/src/roff/groff/groff.am
+++ b/src/roff/groff/groff.am
@@ -87,6 +87,7 @@ groff_TESTS = \
src/roff/groff/tests/draw-spline.sh \
src/roff/groff/tests/driver-C-and-G-options-work.sh \
src/roff/groff/tests/dvi-device-smoke-test.sh \
+ src/roff/groff/tests/error-overflow-symbol-table.sh \
src/roff/groff/tests/evc-request-produces-no-output-if-invalid.sh \
src/roff/groff/tests/fi-and-nf-requests-work.sh \
src/roff/groff/tests/fp-request-does-not-traverse-directories.sh \
diff --git a/src/roff/groff/tests/error-overflow-symbol-table.sh
b/src/roff/groff/tests/error-overflow-symbol-table.sh
new file mode 100755
index 000000000..ba24a9533
--- /dev/null
+++ b/src/roff/groff/tests/error-overflow-symbol-table.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# Copyright 2026 G. Branden Robinson
+#
+# This file is part of groff, the GNU roff typesetting system.
+#
+# groff is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# groff is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+groff="${abs_top_builddir:-.}/test-groff"
+
+# Validate error path and improve code coverage.
+#
+# Verify that we get a fatal error from troff if we create more
+# `symbol`s than "src/libs/libgroff/symbol.cpp" can handle.
+
+output=$(
+n=0
+while :
+do
+ n=$(( n + 1 ))
+ echo ".nr a$n 1"
+done | "$groff" 2>&1)
+
+echo "$output"
+echo "$output" | grep -q '^troff:.*: fatal error:'
+
+# vim:set autoindent expandtab shiftwidth=4 tabstop=4 textwidth=72:
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit