URL:
  <https://savannah.gnu.org/bugs/?65322>

                 Summary: [troff] certain diversion stunts can crash the
formatter
                   Group: GNU roff
               Submitter: gbranden
               Submitted: Fri 16 Feb 2024 08:57:10 PM UTC
                Category: Core
                Severity: 3 - Normal
              Item Group: Crash/Unresponsive
                  Status: Confirmed
                 Privacy: Public
             Assigned to: gbranden
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Fri 16 Feb 2024 08:57:10 PM UTC By: G. Branden Robinson <gbranden>
This is a problem in Git only; I don't see it in 1.23.0.

When you do certain intensely clever things with diversions, as the _mom_
package and _pdf.tmac_ macro file do, you can apparently confuse the formatter
into the wilderness.


$ cat ./EXPERIMENTS/heading.mom
.PRINTSTYLE TYPESET
.START
.HEADING 1 NAMED one "First Heading"
This is a heading.
.HEADING 2 NAMED two "Second Heading"
Let's refer back to the first heading (this
.PDF_LINK one SUFFIX ). +
$ ./build/test-groff -mom -Tpdf ./EXPERIMENTS/heading.mom >| heading.pdf
troff: ../src/roff/troff/input.cpp:626: static int
input_stack::finish_get(node**): Assertion `level == 0' failed.
/home/branden/src/GIT/groff/build/groff: error: troff: Aborted (core dumped)


That assertion was put in by James Clark in _groff_ 1.02 (1991) or earlier. 
I'm going to guess it's not spurious.

My hypothesis is that the `chop` and `asciify` requests in mom's `pdfmomclean`
macro can damage a diversion's contents such that the formatter gets into an
invalid state.


.de pdfmomclean
.   ie '\\n[.z]'' \{\
.      ds pdfcleaned \\$*
.      ev pdfcln
.      tr \[em]-
.      nf
.      box pdf:clean
.      nop \\*[\\*[pdfcleaned]]
.      fl
.      box
.      chop pdf:clean
.      asciify pdf:clean
.      ev
.      ds \\*[pdfcleaned] "\\*[pdf:clean]
.      rm pdf:clean
.      tr \[em]\[em]
.    \}
.    el .nop \!.pdfmomclean \\$@
..


But I place no blame on `pdfmomclean`; the formatter should not permit itself
to be confused in this way.

Figuring out the details will take some digging.







    _______________________________________________________

Reply to this item at:

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

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


Reply via email to