[metapost] Uninitialized variable sometimes causing malformed TFM files

luigi scarso luigi.scarso at gmail.com
Wed Mar 20 18:29:09 CET 2019


On Sat, Mar 16, 2019 at 6:04 PM Marcel Krüger <tex at 2krueger.de> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/metapost/attachments/20190320/3a86e2f8/attachment.html>


More information about the metapost mailing list