Update of bug #68942 (group groff):
Status: Confirmed => In Progress
Planned Release: None => 1.26.0
Summary: [grotty] SEGV on large vertical motion since groff
1.25.0 => [PATCH] [grotty] SEGV on large vertical motion since groff 1.25.0
_______________________________________________________
Follow-up Comment #1:
diff --git a/ChangeLog b/ChangeLog
index 676c4600e..f137305b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2026-11-20 G. Branden Robinson <[email protected]>
+
+ * src/devices/grotty/tty.cpp (tty_printer::add_char): When
+ making a large vertical motion that far exceeds the existing
+ page length, double the size of the page's line count _until_
+ the new vertical position (`vpos`) lies within it, instead of
+ only once.
+
+ Fixes <https://savannah.gnu.org/bugs/?68942>. Problem
+ introduced by me in commit b5ede708b9, 17 March, when revising
+ memory management strategy to address Savannah #68145.
+
2026-11-21 G. Branden Robinson <[email protected]>
[grotty]: Regression-test Savannah #68942.
diff --git a/src/devices/grotty/tty.cpp b/src/devices/grotty/tty.cpp
index b7d0cbfc1..cbac7b6bc 100644
--- a/src/devices/grotty/tty.cpp
+++ b/src/devices/grotty/tty.cpp
@@ -425,7 +425,9 @@ void tty_printer::add_char(output_character c, int w,
tty_glyph **old_lines = lines;
// If we exceed the previous page length, double the size so that
// we don't thrash the allocator. See Savannah #68145.
- int new_nlines = nlines * 2;
+ int new_nlines = nlines;
+ while (vpos > new_nlines)
+ new_nlines *= 2;
lines = 0 /* nullptr */;
try {
lines = new tty_glyph *[new_nlines];
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?68942>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
