[File] tex: Improve dvi and virtualfont detection

Christos Zoulas christos at zoulas.com
Sat Dec 24 22:49:20 UTC 2022


Committed, thanks!

christos

> On Dec 20, 2022, at 3:38 PM, Christoph Biedl <astron.com.bwoj at manchmal.in-ulm.de> wrote:
> 
> Signed PGP part
> Hello,
> 
> Triggered by a bug report in Debian where a (TeX) virtual font was
> mis-detected as MS-DOS executable, I took a brief glance into the story
> and realized things are bad: All these files usually just have 16 bits
> of magic which is way too weak.
> 
> To improve things at least a bit:
> 
> For dvi, there is a "command byte" after the preamble. By probing for
> that we can increase the magic to at least 24 bit. Also, we have
> pstrings now - this avoids some garbage in the output (that very command
> byte usually).
> 
> For vf, there is a command byte as well, acceptable values are 243
> through 245, however I've only encountered 243 in some 20k examples.
> 
> Those who want to dig further, or want to improve the other two file
> formats, check the texlive-bin package, program sources are:
> 
>    TeX packed font data:   texk/ps2pk/pkin.c
>    TeX generic font data:  texk/dvipsk/loadfont.c
>    TeX virtual font data:  texk/dvipsk/virtualfont.c
>    TeX DVI file:           texk/dvipsk/prescan.c
> 
> Look for "!=247", this is the check for the first octet.
> 
> Cheers,
> 
>    Christoph
> <tex-improvments.patch>
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <https://mailman.astron.com/pipermail/file/attachments/20221224/8a1c6346/attachment.asc>


More information about the File mailing list