gbranden pushed a commit to branch master
in repository groff.
commit 21a97e145acfc06e922a38cddf45e0cff6380fc2
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sun Nov 22 01:22:27 2026 -0600
[grotty]: Fix Savannah #62833.
* src/devices/grotty/tty.cpp (tty_printer::add_char): Make more
informative the error diagnostics when the horizontal drawing position
is a large negative or positive value.
Annotate why a negative horizontal drawing position is not a fatal
error.
Fixes <https://savannah.gnu.org/bugs/?62833>. Thanks to Bjarni Ingi
Gislason for the report.
ANNOUNCE: Acknowledge Bjarni.
---
ANNOUNCE | 1 +
ChangeLog | 9 +++++++++
src/devices/grotty/tty.cpp | 12 ++++++++----
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/ANNOUNCE b/ANNOUNCE
index 194489349..cc6e32be0 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -229,6 +229,7 @@ of this release.
instance with "grep -i -A1 thanks ChangeLog". A manual merge of
similar from the contrib/ change log files may also be necessary. ]]
+Bjarni Ingi Gislason
Dave Kemper
Deri James
Dickson Wu
diff --git a/ChangeLog b/ChangeLog
index ed255b94d..6328bca6d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2026-11-22 G. Branden Robinson <[email protected]>
+
+ * src/devices/grotty/tty.cpp (tty_printer::add_char): Make more
+ informative the error diagnostics when the horizontal drawing
+ position is a large negative or positive value.
+
+ Fixes <https://savannah.gnu.org/bugs/?62833>. Thanks to Bjarni
+ Ingi Gislason for the report.
+
2026-11-22 G. Branden Robinson <[email protected]>
* src/devices/grotty/tty.cpp (tty_printer::add_char): Tweak
diff --git a/src/devices/grotty/tty.cpp b/src/devices/grotty/tty.cpp
index 2084db1b0..b6da09fdf 100644
--- a/src/devices/grotty/tty.cpp
+++ b/src/devices/grotty/tty.cpp
@@ -407,10 +407,14 @@ void tty_printer::add_char(output_character c, int w,
fatal("horizontal position not a multiple of horizontal motion quantum");
#endif
int hpos = h / font::hor;
- if (hpos < SHRT_MIN || hpos > SHRT_MAX) {
- error("character with ridiculous horizontal position discarded");
- return;
- }
+ // A negative horizontal drawing position is uncommon, but possible.
+ // "tmac/tests/e_line-numbering-works.sh" illustrates a case.
+ if (hpos < SHRT_MIN)
+ fatal("discarding character with huge negative horizontal position"
+ " %1", h);
+ if (hpos > SHRT_MAX)
+ fatal("discarding character with huge horizontal position %1;"
+ " is terminal wider than %2 character cells?", h, SHRT_MAX);
// The first output line corresponds to drawing position `font::vert`.
int vpos = v / font::vert;
if (vpos <= 0) {
_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit