gbranden pushed a commit to branch master
in repository groff.
commit 7ce29a5aa34c902d3399ec5608f20d15840cabc1
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Dec 21 12:58:49 2025 -0600
[troff]: Drop assertion.
* src/roff/troff/input.cpp (token::description): Drop `assert()`-ion
that is reachable with invalid input.
Avoids core dump in favor of useful diagnostic.
$ nroff
.pl \(nlu
troff:<standard input>:1: error: ignoring invalid numeric expression
starting with nonexistent special character or class
(".pl \n(nlu" was intended.)
---
ChangeLog | 5 +++++
src/roff/troff/input.cpp | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 88e2389fd..db2dca783 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2025-12-21 G. Branden Robinson <[email protected]>
+
+ * src/roff/troff/input.cpp (token::description): Drop
+ `assert()`-ion that is reachable with invalid input.
+
2025-12-21 G. Branden Robinson <[email protected]>
[troff]: Trivially refactor.
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index 3598655fc..b26d608dc 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -3058,7 +3058,7 @@ const char *token::description()
charinfo *ci = get_charinfo(false /* required */,
true /* suppress creation */);
if (0 /* nullptr */ == ci) {
- assert(0 == "attempted to process token without charinfo");
+ // We can get here via, e.g., `.pl \(nlu` (likely a typo).
return "nonexistent special character or class";
}
else if (ci->is_class())
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit