gbranden pushed a commit to branch master
in repository groff.
commit d77f3bf515a23a19f506254d9f0da23cafea68e9
Author: G. Branden Robinson <[email protected]>
AuthorDate: Fri Apr 10 00:01:39 2026 -0500
[libgroff]: Improve fatal diagnostic message.
* src/libs/libgroff/symbol.cpp (symbol::symbol): When construction of a
larger symbol table is impossible, describe the failure better and
report the exceeded table capacity.
Illustration:
$ n=0; while :; do n=$(( n + 1 )); echo ".nr a$n 1"; done \
| ./build/test-groff
troff:<standard input>:597501: fatal error: cannot construct symbol table
larger than 2000003 entries
---
ChangeLog | 7 +++++++
src/libs/libgroff/symbol.cpp | 3 ++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 4d5438c84..56452861d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2026-04-10 G. Branden Robinson <[email protected]>
+
+ * src/libs/libgroff/symbol.cpp (symbol::symbol): Improve fatal
+ diagnostic message; when construction of a larger symbol table
+ is impossible, describe the failure better and report the
+ exceeded table capacity.
+
2026-04-09 G. Branden Robinson <[email protected]>
[libgroff]: Trivially refactor.
diff --git a/src/libs/libgroff/symbol.cpp b/src/libs/libgroff/symbol.cpp
index 154c04fe4..be03e1bbe 100644
--- a/src/libs/libgroff/symbol.cpp
+++ b/src/libs/libgroff/symbol.cpp
@@ -123,7 +123,8 @@ symbol::symbol(const char *p, int how)
int i;
for (i = 1; table_sizes[i] <= old_table_size; i++)
if (table_sizes[i] == 0)
- fatal("too many symbols");
+ fatal("cannot construct symbol table larger than %1 entries",
+ table_sizes[(i - 1)]);
table_size = table_sizes[i];
table_occupancy = 0;
table = (const char **)new char*[table_size];
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit