From 27132e449e4be290ca67fa3b963d16b029363d9a Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Sun, 10 Sep 2017 22:11:43 +0000 Subject: pltotf.ch: web2c extends the range 0..32767 into short (-32768..32767), so add a test of overflow. (H. Yamashita). git-svn-id: svn://tug.org/texlive/trunk@45267 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/ChangeLog | 6 ++++++ Build/source/texk/web2c/pltotf.ch | 15 +++++++++++++++ 2 files changed, 21 insertions(+) (limited to 'Build/source') diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog index 76a2d802378..b6432ed9d4a 100644 --- a/Build/source/texk/web2c/ChangeLog +++ b/Build/source/texk/web2c/ChangeLog @@ -1,3 +1,9 @@ +2017-09-10 Hironobu Yamashita + + * pltotf.ch: web2c extends the range of 'lf' from 0..32767 + into short (-32768..32767), but the overflow here ends up in + Bad metric (TFM) file. So add a test. + 2017-03-27 Karl Berry * Makefile.am (AM_TESTS_ENVIRONMENT): use instead of TESTS_ENVIRONMENT. diff --git a/Build/source/texk/web2c/pltotf.ch b/Build/source/texk/web2c/pltotf.ch index 7668fad9034..587b332c6d4 100644 --- a/Build/source/texk/web2c/pltotf.ch +++ b/Build/source/texk/web2c/pltotf.ch @@ -188,6 +188,21 @@ endif('notdef') @d out(#)==putbyte(#,tfm_file) @z +% [130] web2c extends the range of 'lf' from 0..32767 into +% short (-32768..32767), but the overflow here ends up in +% Bad metric (TFM) file. So we add test here. +@x +lf:=6+lh+(ec-bc+1)+memory[width]+memory[height]+memory[depth]+ +memory[italic]+nl+lk_offset+nk+ne+np; +@y +lf:=6+lh+(ec-bc+1)+memory[width]+memory[height]+memory[depth]+ +memory[italic]+nl+lk_offset+nk+ne+np; +if lf<0 then begin + print_ln('The total number of words in the TFM file too large!'); + uexit(1); + end +@z + @x [136] Fix output of reals. @p procedure out_scaled(x:fix_word); {outputs a scaled |fix_word|} var @!n:byte; {the first byte after the sign} -- cgit v1.2.3