gbranden pushed a commit to branch master
in repository groff.
commit bed13a94b78bf22c2a415a4bbba2721a2388becd
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon May 19 20:57:23 2025 -0500
[groff]: Regression-test Savannah #67139.
...attempted closure of a regular diversion with the `box` request
causes invalid memory access.
* src/roff/groff/tests/do-not-crash-on-mismatched-diversion-request.sh:
Do it.
* src/roff/groff/groff.am (groff_TESTS): Run test.
Test fails at this commit.
Arbitrary milestone observance: this is our 250th automated test script.
---
ChangeLog | 10 ++++++
src/roff/groff/groff.am | 1 +
...do-not-crash-on-mismatched-diversion-request.sh | 41 ++++++++++++++++++++++
3 files changed, 52 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 883c632df..1a323c27d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2025-05-19 G. Branden Robinson <[email protected]>
+
+ [groff]: Regression-test Savannah #67139 (attempted closure of a
+ regular diversion with the `box` request causes invalid memory
+ access).
+
+ * src/roff/groff/tests/\
+ do-not-crash-on-mismatched-diversion-request.sh: Do it.
+ * src/roff/groff/groff.am (groff_TESTS): Run test.
+
2025-05-19 G. Branden Robinson <[email protected]>
* src/preproc/html/pre-html.cpp: Enable debugging code, ripping
diff --git a/src/roff/groff/groff.am b/src/roff/groff/groff.am
index 51fa0819f..ddc7d164e 100644
--- a/src/roff/groff/groff.am
+++ b/src/roff/groff/groff.am
@@ -57,6 +57,7 @@ groff_TESTS = \
src/roff/groff/tests/device-request-passes-most-escape-sequences.sh \
src/roff/groff/tests/device-request-works.sh \
src/roff/groff/tests/devicem-request-works.sh \
+ src/roff/groff/tests/do-not-crash-on-mismatched-diversion-request.sh \
src/roff/groff/tests/do-not-free-file-name-pointers-early.sh \
src/roff/groff/tests/do-not-loop-infinitely-when-breaking-cjk.sh \
src/roff/groff/tests/dot-b-register-works.sh \
diff --git
a/src/roff/groff/tests/do-not-crash-on-mismatched-diversion-request.sh
b/src/roff/groff/tests/do-not-crash-on-mismatched-diversion-request.sh
new file mode 100755
index 000000000..ab65a35e7
--- /dev/null
+++ b/src/roff/groff/tests/do-not-crash-on-mismatched-diversion-request.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# Copyright (C) 2025 Free Software Foundation, Inc.
+#
+# This file is part of groff.
+#
+# groff is free software; you can redistribute it and/or modify it over
+# 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"
+
+# troff should not perform invalid memory access when using `box` to
+# close a regular diversion. Savannah #67139.
+
+if [ -e core ]
+then
+ echo "$0: 'core' file already exists; skipping" >&2
+ exit 77 # skip
+fi
+
+input='.
+.di d
+.box
+all is well
+.'
+
+output=$(printf '%s\n' "$input" | "$groff" -a)
+! test -e core
+
+# vim:set autoindent expandtab shiftwidth=4 tabstop=4 textwidth=72:
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit