aminophen / dviasm

DVIasm — a TeX utility program for editing DVI files directly
9 stars 4 forks source link

Problematic DVI format of dviasm: FNTDEF before BOP #20

Open aminophen opened 2 years ago

aminophen commented 2 years ago
$ tex \\relax a\\end                           % => "texput.dvi" is written
$ dviasm texput.dvi >texput.dump
$ dviasm texput.dump -o texput.dump.dvi

The resulting "texput.dump.dvi" seems valid (at least for dvitype), but FNTDEF comes before BOP; I think such a DVI format is valid, as dvitype and most of the major DVI drivers accept it. However, there are some issues:

(1) dvi2tty hangs after an error

$ dvi2tty texput.dump.dvi
dvi2tty: Missing beginning-of-page command

It waits for user [Return] input, instead of exiting right away.

(2) dvispc fails to print FNTDEF before BOP.

$ dvispc -a texput.dump.dvi >texput.dump.spc.txt

It ignores FNTDEF before BOP as written in "texput.dump.dvi".

(3) dvi2tty crashes while processing dvispc's result

$ dvispc -x texput.dump.spc.txt texput.dump.spc.dvi
$ dvi2tty texput.dump.spc.dvi
Segmentation fault: 11

The dvispc's result "texput.dump.spc.dvi" does not contain FNTDEF before BOP or before the appearance of SETCHAR, so it's actually problematic (dvipdfmx seems ok, but dvips fails)

$ dvips texput.dump.spc.dvi
"This is dvips(k) 2022.1 (TeX Live 2022)  Copyright 2022 Radical Eye Software (www.radicaleye.com)
' TeX output 2022.03.10:2237' -> texput.spc.ps
Font number 0 not found
dvips: ! no font selected

but dvitype does not complain about it, so I'm not sure such a DVI file is valid. However, in any circumstances dvi2tty should not cause a segmentation fault.

aminophen commented 2 years ago

Issue of dvi2tty reported https://github.com/texjporg/tex-jp-build/issues/138, but I want to consider improving dviasm.

aminophen commented 2 years ago

(3) dvi2tty crashes while processing dvispc's result

Fixed in r62644.