summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/pltotf.ch
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2017-09-10 22:11:43 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2017-09-10 22:11:43 +0000
commit27132e449e4be290ca67fa3b963d16b029363d9a (patch)
tree432d6a91c059ac40afceb874e7f1d368c91fc6e6 /Build/source/texk/web2c/pltotf.ch
parent23056da81dd216ac377e040b70c9b78e01c94186 (diff)
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
Diffstat (limited to 'Build/source/texk/web2c/pltotf.ch')
-rw-r--r--Build/source/texk/web2c/pltotf.ch15
1 files changed, 15 insertions, 0 deletions
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}