Re: Uninitialized variable sometimes causing malformed TFM files

luigi scarso <[email protected]> Wed, 20 Mar 2019 18:29:09 +0100
Newsgroups gmane.comp.tex.metapost
Message-ID <CAG5iGsALzOz6RRds_9GEEN8TzMyiuAPHipQohgs0gyHzXN5vMQ@mail.gmail.com>
On Sat, Mar 16, 2019 at 6:04 PM Marcel Krüger <[email protected]> wrote:

> Hi,
>
> the `indep_value` of `mp->zero_val` is never initialized, but it is used
> the index written into the
> depth / ... fields in the TFM files for glyphs with zero depth/.... This
> causes malformed TFM files.
>
> On my system the TFM corruption can be observed when using LuaTeX to build
>
> \directlua{
> local find_file
> do
>   local kpse = kpse.new('lualatex', 'mpost')
>   find_file = function(name, mode, type)
>     return mode == 'w' and name or kpse:find_file(name, type) or (type ==
> 'mp' and kpse:find_file(name, 'mf'))
>   end
> end
> local mp = mplib.new{
>   job_name = 'cmr10',
>   find_file = find_file,
>   math_mode = 'scaled',
> }
> local result = mp:execute'input mfplain;mode:=localfont;input cmr10.mf;'
> print(result.term)
> }
> \bye
>
> Using standalone MetaPost I could not trigger this and the problem does
> not appear with the
> LuaTeX binary from TeXLive binary from pretest, but custom built luatex
> versions from both the experimental
> and the trunk branch showed the problem. The luatex binary available
> through the contextgarden seems to be affected too.
>
> The problem can be fixed by adding
>
> set_indep_value (mp->zero_val, 0);
>
> below
>
> @ @<Initialize table entries@>=
> mp->zero_val = mp_get_value_node (mp);
> set_value_number (mp->zero_val, zero_t);
>
> in mp.w (Around line 33774)
>
>
> Best regards
> Marcel Krüger
>
>
sorry for delay, I will it asap.

-- 
luigi

--
http://tug.org/metapost/