bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #65930] [me] large values of register `tv` cause infinite trap recu


From: G. Branden Robinson
Subject: [bug #65930] [me] large values of register `tv` cause infinite trap recursion
Date: Tue, 2 Jul 2024 19:18:50 -0400 (EDT)

Update of bug #65930 (group groff):

                  Status:               Confirmed => Need Info              
             Assigned to:                    None => barx                   
                 Summary: [me] Large values of register "tv" cause fatal error
=> [me] large values of register `tv` cause infinite trap recursion

    _______________________________________________________

Follow-up Comment #2:

Hi Dave,

Try this patch:


$ git diff
diff --git a/tmac/e.tmac b/tmac/e.tmac
index 48962de54..98b4761de 100644
--- a/tmac/e.tmac
+++ b/tmac/e.tmac
@@ -459,6 +459,10 @@ .de @e                     \" --- end page
 .de @t                 \" --- output header or footer title
 .if !\\n(?h \
 \{\
+.      \" Temporarily set vertical spacing to zero so `sz` doesn't
+.      \" spring the footer trap again in infinite regress.
+.      nr _t \\n(tv
+.      nr tv 0
 .      sz \\n(tp\"             \" set header/footer type fonts, etc.
 .      @F \\n(tf
 .      lt \\n(_Lu              \" make title span entire page
@@ -469,6 +473,9 @@ .de @t                      \" --- output header or footer
title
 .      br
 .      if \\n(?n \
 .              nm
+.      nr tv \\n(_t
+.      rr _t
+.      sz \\n(tp\"             \" restore vertical spacing
 .\}
 ..
 .


I used the following very slightly more realistic document to further test
it.


$ cat EXPERIMENTS/tv-stack-limit.me
.nr $v 1640u
.fo 'foo'bar'baz'
.lp
You get the diplomatic treatment
.br
You get the force-fed future
.br
You get the funk after death
.br
You get the weisenheimer brainstorm


Two caveats:

1.  With a well-tuned `tv` (or `$v`), you can cause the footer to overprint
body text (the above does in _nroff_ mode but not _troff_ mode).  I haven't
explored whether this is possible with less huge but still crafty values on
older _groff_s.

2.  The bottom margin grows huge in this example.  I don't know yet if this is
a facet of bug #60553, but it may well be.  If so, this patch suggests a
similar solution to that ticket: compute the vertical margins based on a `tv`
of zero.  If I'm right about Allman not contemplating multi-line
headers/footers (a restriction that is true of _ms_ but not _mm_), then that
approach may resolve that issue.

Do you think this patch is good enough as-is to resolve this ticket?


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?65930>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]