gbranden pushed a commit to branch master
in repository groff.
commit 3773b818b9005f9129a8d16b9bf7f6c23cec6f51
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Oct 22 10:10:03 2026 -0500
[troff]: Fix Savannah #68817.
* src/roff/troff/input.cpp (alias_macro): Replace assert(3)ion that
could be tripped by invalid characters in macro/string/request/
diversion identifier with skip of input line.
Fixes <https://savannah.gnu.org/bugs/?68817>. Problem introduced by me
in commit 12cb5ec593, 2024-09-20.
---
ChangeLog | 11 +++++++++++
src/roff/troff/input.cpp | 23 ++++++++++++-----------
2 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index bbd88e3b2..725387ddb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2026-10-22 G. Branden Robinson <[email protected]>
+
+ [troff]: Fix Savannah #68817.
+
+ * src/roff/troff/input.cpp (alias_macro): Replace assert(3)ion
+ that could be tripped by invalid characters in macro/string/
+ request/diversion identifier with skip of input line.
+
+ Fixes <https://savannah.gnu.org/bugs/?68817>. Problem
+ introduced by me in commit 12cb5ec593, 2024-09-20.
+
2026-10-22 G. Branden Robinson <[email protected]>
[groff]: Regression-test Savannah #68817.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 13f6a4558..9a9357d48 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -5887,18 +5887,19 @@ static void alias_macro() // .als
return;
}
symbol s1 = read_identifier();
- assert(s1 != 0 /* nullptr */);
- if (!s1.is_null()) {
- symbol s2 = read_identifier();
- if (s2.is_null())
- warning(WARN_MISSING, "name aliasing request expects identifier"
- " of existing request, macro, string, or diversion as"
- " second argument");
- else {
- if (!request_dictionary.alias(s1, s2))
- error("cannot alias undefined name '%1'", s2.contents());
- }
+ if (s1.is_null()) {
+ // The identifier was garbage, like `a\&b`.
+ skip_line();
+ return;
+ }
+ symbol s2 = read_identifier();
+ if (s2.is_null()) {
+ // The identifier was garbage, like `a\&b`.
+ skip_line();
+ return;
}
+ if (!request_dictionary.alias(s1, s2))
+ error("cannot alias undefined name '%1'", s2.contents());
skip_line();
}
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit