[tex-k] Total number of words in pltotf

Hironobu Yamashita h.y.acetaminophen at gmail.com
Sat Sep 9 22:48:07 CEST 2017

I found a problem in 'pltotf' program:

When huge LIGKERN program is used like this (lklarge0.pl),

'pltotf' does not complain about it but both 'tftopl' and 'tex'
complains about the output TFM:

$ pltotf lklarge0
$ tftopl lklarge0 temp
The first byte of the input file exceeds 127!
Sorry, but I can't go on; are you sure this is a TFM?
$ tex "\font\x=lklarge0 at 10pt\x A\bye"
! Font \x=lklarge0 at 10.0pt not loadable: Bad metric (TFM) file.

What is worse, 'uptftopl' fails to allocate memory for huge
GLUEKERN table like this (gklarge0.pl),

$ uptftopl gklarge0 temp
Input file is in YOKO-kumi kanji tfm format.
uptftopl(17192,0x7fff760ef000) malloc: *** mach_vm_map(size=18446744073709428736) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
fatal: memory exhausted (realloc of 18446744073709426269 bytes).

The reason for both problems seems to lie in pltotf.web, which
does not test whether lf (total number of words) exceeds 2^{15},
which results in negative number.

By adding (for web2c compiler)

if lf<1 then begin
  print_ln('The total number of words in the TFM file too large!');

at the end of @<Compute the twelve...@>= routine, these problems
can be avoided.

Hironobu Yamashita

More information about the tex-k mailing list