gbranden pushed a commit to branch master
in repository groff.
commit ba660bda6d4f19a7c1432f8a510ff4f0664328d7
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Jul 26 00:11:54 2026 -0500
[troff]: Fix Savannah #68558.
* src/roff/troff/input.cpp (do_request): If given a first argument that
is an invalid request or macro name, we cannot sensibly proceed:
unwind the "compatibility stack" manipulation we just did and return
early, maintaining the integrity of aforesaid stack.
Fixes <https://savannah.gnu.org/bugs/?68558>. Problem appears to date
back at least to groff 1.22.3 (2014), and possibly much earlier.
---
ChangeLog | 14 ++++++++++++++
src/roff/troff/input.cpp | 9 ++++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 3ca5b42f3..9ff3618f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2026-07-24 G. Branden Robinson <[email protected]>
+
+ [troff]: Fix Savannah #68558.
+
+ * src/roff/troff/input.cpp (do_request): If given a first
+ argument that is an invalid request or macro name, we cannot
+ sensibly proceed: unwind the "compatibility stack" manipulation
+ we just did and return early, maintaining the integrity of
+ aforesaid stack.
+
+ Fixes <https://savannah.gnu.org/bugs/?68558>. Problem appears
+ to date back at least to groff 1.22.3 (2014), and possibly much
+ earlier.
+
2026-07-24 G. Branden Robinson <[email protected]>
[groff]: Regression-test Savannah #68558.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index f3657fc99..f63de35e5 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -3494,11 +3494,18 @@ static void do_request() // .do
skip_line();
return;
}
+ // We must attempt to read the first request argument--a request or
+ // macro identifier--with compatibility mode _off_, but if the user
+ // doesn't supply a valid one, we must unwind.
want_att_compat_stack.push(want_att_compat);
want_att_compat = false;
symbol nm = read_identifier();
- if (nm.is_null())
+ if (nm.is_null()) {
+ want_att_compat = want_att_compat_stack.top();
+ want_att_compat_stack.pop();
skip_line();
+ return;
+ }
else
interpolate_macro_or_invoke_request(nm, true /* don't want next token */);
assert(!want_att_compat_stack.empty());
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit